in reply to Re: replace @ARGV args with Getopt::Long switches
in thread replace @ARGV args with Getopt::Long switches
Here's what ended up working:
use Getopt::Long; GetOptions( 'infile|i=s' => \$opt_infile, ); if (defined $opt_infile) { $file{in} = $opt_infile; open (INFILE, "< $file{in}") or die "Error opening $file{in}: $!"; @targets = <INFILE>; close INFILE or die "Error closing $file{in}: $!"; } else { die "Input file not specified!"; } foreach my $nonsane(@targets) { chomp $nonsane; unless ($nonsane =~ (/^(\w|-|\.)+$/)) { print " $nonsane is an improperly formatted device name.\n"; print " Only alphanumeric, underscore, dash and dot allowed.\ +n"; print " Edit $file{in} to remove puctuation, blank lines and/ +or blank spaces.\n"; exit; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re:(2) replace @ARGV args with Getopt::Long switches (graci)
by jeroenes (Priest) on Apr 12, 2001 at 10:27 UTC |