in reply to Re: Re: Returning first element of an array from a function
in thread Returning first element of an array from a function
($foo,undef) = split( /\./, $bar );
That way I explicitly throw away the rest of the list instead of discarding it implicitly.
You're not explicitly throwing away the rest of the list... you're just explicitly ignoring the second element returned and then non-explicitly ignoring the rest of it. Using undef to ignore returned elements is only useful if you're going to capture something after the undef'ed element (ie: ($foo, undef, $bar) = split(/\./, $baz); or (undef, $foo) = split(/\./, $bar);).
In Section
Seekers of Perl Wisdom