lcanty has asked for the wisdom of the Perl Monks concerning the following question:
Afternoon fellow monks,
I've only just started learning Perl and have been a little stumped with the following,i know perl has lots of nifty shortcuts but is this possible...
I've only just started learning Perl and have been a little stumped with the following,i know perl has lots of nifty shortcuts but is this possible...
given a function, (the one i've been using is split) that returns an array is it possible to only return the first element of the array from the function and assign that to a scalar...
i.e
$bar = "some.text";
$foo = split(/\./,$bar);
now i know i could make $foo an array like @foo and access the first element of that.
But is there something i can do with the function on the right to return the first element of the array directly to $foo...
thanks
-Li
Back to
Seekers of Perl Wisdom