goldtech wrote:
Hi,
If I have:
...
foreach (@ARGV) {
print "do something only to .mdb files";
}
I could use File::Basename's fileparse and test for the file extension
and put a big if statement around or in the foreach loop. So if a user
puts a non .mdb file argument on the cmd line it won't process and
prints a usage.
But I suspect in perl theres a more compact way of doing that?
use strict;
use warnings;
if (grep { not /\.mdb\z/ } @ARGV) {
print "All parameters must be MDB files\n";
exit;
}
foreach (@ARGV) {
print "do something only to .mdb files";
}
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/