In Perl, you can get a list of files matching the pattern:
my @list = <*.txt>;
print "@list";
Now, I would like to pass the template as a variable (because it passed into the function). But this does not work:
sub ProcessFiles {
my ($pattern) = @_;
my @list = <$pattern>;
print "@list";
}
readline() on unopened filehandle at ...
Any suggestions?
source
share