the_0ne has asked for the wisdom of the Perl Monks concerning the following question:
...when I run './cmd_line_args.pl -foo -bar' gives me...map { s/^-// } @ARGV; print join ("\n", @ARGV) . "\n";
Which is what I would think it should, but then why does this not work...foo bar
my @array = map { s/^-// } @ARGV; print join ("\n", @array) . "\n";
I'm not understanding why the first code snippet works but the next code snippet, which the only difference is setting the results of the map to an array, gives me scalar output.1 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Map not giving me what I thought it would.
by dvergin (Monsignor) on Jun 02, 2001 at 08:46 UTC | |
|
Re: Map not giving me what I thought it would.
by wog (Curate) on Jun 02, 2001 at 08:47 UTC | |
|
Re: Map not giving me what I thought it would.
by converter (Priest) on Jun 02, 2001 at 18:21 UTC | |
|
Re: Map not giving me what I thought it would.
by damian1301 (Curate) on Jun 02, 2001 at 08:54 UTC | |
|
Re: Map not giving me what I thought it would.
by princepawn (Parson) on Jun 02, 2001 at 08:55 UTC | |
|
Re: Map not giving me what I thought it would.
by adamsj (Hermit) on Jun 02, 2001 at 09:16 UTC | |
|
Re: Map not giving me what I thought it would.
by the_0ne (Pilgrim) on Jun 02, 2001 at 09:16 UTC |