in reply to How to access directly an element of an array / list returned by a function?
Turn it not into an anonymous array, but an anonymous list, and you have the standard Perl idiom:
my $name = ( File::Spec->splitpath($path) )->[2];
update: must have been the caffeine level dropping too low .. .no need for '->' in list.
As Occam said: Entia non sunt multiplicanda praeter necessitatem.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to access directly an element of an array / list returned by a function?
by stevieb (Canon) on Aug 26, 2010 at 17:42 UTC | |
by vic2608 (Initiate) on Aug 26, 2010 at 17:47 UTC | |
by Anonymous Monk on Aug 26, 2010 at 19:04 UTC |