my @files = io('.')->all_files;
$files[0] > io( "/tmp/$files[0]" );
By forcibly stringifying your original solution should work as well:
my @files = io('.')->all_files;
io( "$files[0]" ) > io( "/tmp/$files[0]" );
But I don't want to be the maintenance programmer then..
But, are you using @files at all otherwise? Sounds like you just want the first — in which case I'd use
my $file = io( '.' )->next;
$file > io( "/tmp/$file" );
Also, are you sure you need the file named after the original? If not, it's better to let IO::All pick a temporary name for you.
my $tmp = io;
io( '.' )->next > $tmp;
Makeshifts last the longest.
|