($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);).
|Replies are listed 'Best First'.|
Re^4: Returning first element of an array from a function
by Anonymous Monk on Mar 17, 2004 at 08:55 UTC
by Anonymous Monk on Mar 17, 2004 at 09:10 UTC