develooper Front page | perl.perl5.porters | Postings from September 2012

[perl #3605] attributes don't like .=

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
September 25, 2012 12:51
Subject:
[perl #3605] attributes don't like .=
Message ID:
rt-3.6.HEAD-11172-1348602690-311.3605-15-0@perl.org
On Tue Jun 10 03:32:54 2008, animator wrote:
> From the bug report:
> 
> perl -e 'my $var : locked .= "test"'
> Invalid separator character '.' in attribute list at -e line 1, near 
> "$var : locked "
> syntax error at -e line 1, near "$var : locked "
> Execution of -e aborted due to compilation errors.
> 
> 
> On Sat Jun 07 11:27:16 2008, reneeb wrote:
> > I don't know if this should be valid syntax. It's a declaration of a
> > variable, so there's nothing to concatenate...
> 
> But:
> 
> perl -e 'my $var .= "test";'
> 
> Does not produce a syntax error.
> 
> Should this inconsistency remain? Or should it go away?

It’s also a problem with just plain ‘.’.  In fact, the introduction of
attributes broke this perfectly valid syntax:

$ ./perl -Ilib -e '$ref = \($1 ? my $var : my $othervar)'
Invalid separator character '$' in attribute list at -e line 1, near
"$var : my "
Execution of -e aborted due to compilation errors.

I’m not even sure how the attribute syntax should behave.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=3605

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About