Hi,
I'm not an expert Perl developer, but I may be able
to help you. Here's the way I've done it in the past:
----------------begin code
sample------------------
#!/usr/bin/perl -w
use strict;
my $input_dir = '/path/to/files/'; #
directory to search
my $fileext =
'.lisa'; #
file extension to find
my $count =
0;
# files found counter
my %files =
();
# hash for file list
# open filehandle to read output from "ls"
command
open(INF,"ls $input_dir|") or
&error_msg("Cannot get directory listing for \'$input_dir\'. Error:
\'$!\'\n");
while(<INF>) { chomp; # drop line terminator if ($_ =~ m/$fileext$/) # match files ending in specified file extension { $files{$count} = $_; # add entry to hash
$count++;
# increment file counter
}
close(INF); # drop
filehandle
exit(0);
----------------end code
sample------------------
I hope this helps.
Tom
|