[Bug 1150693] Perl quick concatenate doesn't work

bugzilla at redhat.com bugzilla at redhat.com
Thu Oct 9 03:00:56 UTC 2014


https://bugzilla.redhat.com/show_bug.cgi?id=1150693

Ralf Corsepius <rc040203 at freenet.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |CLOSED
         Resolution|---                         |NOTABUG
        Last Closed|                            |2014-10-08 23:00:56



--- Comment #1 from Ralf Corsepius <rc040203 at freenet.de> ---
Your example isn't valid perl.

# cat example1
#!/usr/bin/perl -w
my $foo = "Foo";
my $bar = "Bar";
my $foo .= $bar;
print $foo;

# ./example1
"my" variable $foo masks earlier declaration in same scope at ./foo line 4.


Removing the second my $foo lets your example work as expected:

# cat example2
#!/usr/bin/perl -w
my $foo = "Foo";
my $bar = "Bar";
$foo .= $bar;
print $foo;

# ./example2
FooBar

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Unsubscribe from this bug https://bugzilla.redhat.com/token.cgi?t=wH1v7C1Ul4&a=cc_unsubscribe



More information about the perl-devel mailing list