It's impossible to do exactly that, since a sub can only return a list of scalars. The entire list would be assigned to @file.
You could return array references, though.
sub getfile { ... return ( \@file, \@file2 ); } my ($file, $file2) = getfile('file.txt', 'file2.txt'); for (@$file ) { ... } for (@$file2) { ... }
In reply to Re: Multiple variables sub
by ikegami
in thread Multiple variables sub
by Kirche
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |