dushyant has asked for the wisdom of the Perl Monks concerning the following question:
Please explain how and why value of @_ is keeps changing in same subroutine "formatlist" in below code
[root@mail ~]# perl test.pl -w -w out return Command Line in return Command Line: -w [root@mail ~]# cat test.pl sub formatlist { my @list = @_; print @_, ' out return', "\n"; return sub { print @_, ' in return', "\n"; my $title = shift; print "$title: ", join(' ',@list),"\n"; } } $arguments = formatlist(@ARGV); &$arguments('Command Line'); [root@mail ~]#
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: @_ & @ARGV
by moritz (Cardinal) on Oct 07, 2012 at 14:48 UTC | |
|
Re: @_ & @ARGV
by NetWallah (Canon) on Oct 07, 2012 at 14:56 UTC | |
by Athanasius (Archbishop) on Oct 07, 2012 at 15:12 UTC | |
by tobyink (Canon) on Oct 07, 2012 at 15:19 UTC | |
by dushyant (Acolyte) on Oct 07, 2012 at 17:41 UTC |