E
ebm
Does anybody know who to get this to work if the $sufix has a * in it.
Would I have to have the script do something like this?
if ($sufix =~ /\*/) {
if( /^\Q$prefix/ && /$sufix*$/ ) {
print("$_ \n");
}
}
Any ideas?
# look for files
my $sufix = '.log*'; #added for testing, normally read in from a
config file
my $prefix = 'blah'; #added for testing, normally read in from a
config file
my @files;
opendir(LOCALLOG,$path) || die("Unable to open $path, Verify the path
exists:$!"); #open Local Path log directory
@files = grep {-f "$path/$_"} readdir(LOCALLOG); # get array of
files
close(LOCALLOG);
foreach(@files){
if( /^\Q$prefix/ && /$sufix$/ ) {
print("$_ \n");
}
}
Would I have to have the script do something like this?
if ($sufix =~ /\*/) {
if( /^\Q$prefix/ && /$sufix*$/ ) {
print("$_ \n");
}
}
Any ideas?
# look for files
my $sufix = '.log*'; #added for testing, normally read in from a
config file
my $prefix = 'blah'; #added for testing, normally read in from a
config file
my @files;
opendir(LOCALLOG,$path) || die("Unable to open $path, Verify the path
exists:$!"); #open Local Path log directory
@files = grep {-f "$path/$_"} readdir(LOCALLOG); # get array of
files
close(LOCALLOG);
foreach(@files){
if( /^\Q$prefix/ && /$sufix$/ ) {
print("$_ \n");
}
}