in reply to Re: Returning first element of an array from a function
in thread Returning first element of an array from a function
This both avoids building the list that AnonyMonk so correctly pointed out above, plus gains the documentation benefits of using slicing.my $bar = (split /,/, $foo, 2)[0];
This isn't possible to do with all cases, but it is quite useful.
------
We are the carpenters and bricklayers of the Information Age.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|