in reply to statement vs. block?
If the block has a list in it, you can't use it as a "statement".
use Data::Dumper; my @short = (0..2); my @x = map { ($_, $_) } @short; print Dumper \@x; my @y = map ($_, $_), @short; print Dumper \@y; __END__ $VAR1 = [ 0, 0, 1, 1, 2, 2 ]; $VAR1 = [ undef ];
With warnings, this says "Useless use of private array in void context".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: statement vs. block?
by Fletch (Bishop) on Apr 11, 2008 at 23:46 UTC | |
by kyle (Abbot) on Apr 11, 2008 at 23:55 UTC | |
by Fletch (Bishop) on Apr 12, 2008 at 00:13 UTC |