InfiniteSilence has asked for the wisdom of the Perl Monks concerning the following question:
I thought perhaps you couldn't force list context out of the return value from a function:perl -e "print @{localtime}[1,3];"
butperl -e "sub m {return (1,2,3);} print @{&m}[0,1];" #fails
Pardon my ignorance on all this. I am testing out stuff I am learning from Effective Perl Programming (this book rocks) on array slices.perl -e "sub m {@q=(1,2,3); return \@q;} print @{&m}[0,1];" #succeeds
Celebrate Intellectual Diversity
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: localtime array slice problem
by dchetlin (Friar) on Jan 11, 2001 at 20:33 UTC | |
|
Re: localtime array slice problem
by ChOas (Curate) on Jan 11, 2001 at 20:36 UTC | |
by InfiniteSilence (Curate) on Jan 12, 2001 at 00:32 UTC | |
by chipmunk (Parson) on Jan 12, 2001 at 01:48 UTC | |
|
Re: localtime array slice problem
by I0 (Priest) on Jan 11, 2001 at 20:35 UTC |