in reply to How to access directly an element of an array / list returned by a function?

Functions can't return arrays, they can only return a list of scalars. How does one extract a scalar from a list of scalars? Using a list slice.
( EXPR )[$index] ( EXPR )[@indexes]
So,
use File::Spec qw( ); my $file = ( File::Spec->splitpath($path) )[2];
There's also
use File::Basename qw( basename ); # Also core module my $file = basename($path);
use File::Path qw( file ); # Addresses issues with File::Spec my $file = file($path)->basename();