That doesn't work with the dereferencing operator (->), since the return of File::Spec->splitpath is not a reference. This works:
Stevemy $name = ( File::Spec->splitpath($path) )[2];
In reply to Re^2: How to access directly an element of an array / list returned by a function?
by stevieb
in thread How to access directly an element of an array / list returned by a function?
by vic2608
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |