![]() |
|
Syntactic Confectionery Delight | |
PerlMonks |
Re: Returning first element of an array from a functionby matija (Priest) |
on Mar 17, 2004 at 07:49 UTC ( #337247=note: print w/replies, xml ) | Need Help?? |
If you're using someone else's function, and only want the first element, you can do something like this: If you're writing your own function, you can use the wantarray function to tell if the function has been called in an array or scalar context:
In Section
Seekers of Perl Wisdom
|
|