Can anyone tell me why when matching E$ option it finds ZE instead? What I have is a script that looks at a file from an exchange, parses each line looking for specific products, i.e. E$, ZE, GE etc. Fro some reason when I ask the file to single out E$ it brings back all the matches for ZE, all the others come back just fine. My second question is when I use getopt it never detects incorrect usage if you leave out an options and complains about the variable not being there instead of informing the user they missed an option.
Thanks for the help! Tim #!/usr/bin/perl -w use strict; use Getopt::Std; use vars qw($opt_s $opt_d $opt_g $opt_t); my $source; my $dest; my $grp; my $typ; if (! getopts('s:d:g:t:')) { die "Usage: cmeparser -s -d -g -t\n"; } if ($opt_s) { $source = $opt_s; } if ($opt_d) { $dest = $opt_d; } if ($opt_g) { $grp = $opt_g; } if ($opt_t) { $typ = $opt_t; } open (CME, "$source") or die "Can't open file: $!\n"; open (CATUS, ">>$dest") or die "Can't open file: $!\n"; while (<CME>) { if ($grp =~ /(E$)/) { $grp = "E\$"; } if ( substr($_, 69,2) =~ /$grp/) { if ( substr($_, 91, 2) =~ /$typ/) { print CATUS; } } }