duranain has asked for the wisdom of the Perl Monks concerning the following question:
Produces the following output:@perls = (1, 2, 3, 4) sub foo { my @foo = @{shift()}; return join $/, @foo } print foo(\@perls)
however, if i change line 4 to:one two three four
no output is produced after running. How exactly is @{shift()} being passed the contents of @_? At the moment this looks like witchcraft to me but I'd really like to know how this works.my @foo = @{shift};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can someone clarify what's happening here
by toolic (Bishop) on Aug 11, 2010 at 01:41 UTC | |
by duranain (Initiate) on Aug 11, 2010 at 02:03 UTC | |
by ikegami (Patriarch) on Aug 11, 2010 at 02:20 UTC | |
|
Re: Can someone clarify what's happening here
by derby (Abbot) on Aug 11, 2010 at 10:21 UTC | |
|
Re: Can someone clarify what's happening here
by biohisham (Priest) on Aug 11, 2010 at 09:07 UTC |