For example:
#!/usr/bin/perl
my @arr = ('/usr/test/test.*.con');
my $result = FileExists(\@arr);
print $result;
sub FileExists {
my $param = shift;
foreach my $file (@{$param}) {
print $file;
if (-e $file) {
return 1;
}
}
return 0;
}
It returns 0. But I want to find all wild characters too… How can I solve this?
-ecan’t handle file globs. Change this lineto
To expand the glob pattern first and then check the matched files for existence. However, since glob will only return existing files matching the pattern, all the files will exist anyway.