
Cupidvogel
Novice
Mar 29, 2012, 10:06 PM
Post #1 of 3
(911 views)
|
|
Problem with scalar reference
|
Can't Post
|
|
Hi, can anyone explain why the second example in this code shows syntax error and the third example prints out Not a SCALAR reference, while the first example runs as expected?
my @a = @{[do { local $_ = "fool\n"; chomp; $_ ; } ]}; print "@a"; ## prints "fool" $b = ${do { local $_ = "cool\n"; chomp; $_; }}; print "\n$b"; $c = ${do { local $_ = "cool\n"; chomp; $_; }}; print "\n$c";
|