in reply to Checking Input using reg exp.
HTH grep#!/usr/local/bin/perl -w $cnip = $ENV{'QUERY_STRING'}; print "\n Look Up NPANXX Info"; print "\n =============================="; print "\n Please enter NPANXX:_______\b\b\b\b\b\b\b +"; chomp($cnip=<STDIN>); if($cnip =~ /\d{6}/){ @datb = `cat tech3 | grep $cnip`; #You could do this a a file open + and grep the contents... it would be more portable and perlyer :) @cnip = $cnip; #printing the info foreach $datb (@datb){ @cnip = split (\/\:/, $datb); print "\n ===================================== +===\n"; print " NPANXX Line Switch MSR&CUSTGP VMX"; print " $cnip $cnip[1] $cnip[2] $cnip[3] $cnip[4] $cnip +[5]"; print " ======================================= +=\n\n"; } @datb = `cat tech3 | grep $cnip`; @cnip = $cnip; #printing the info foreach $datb (@datb){ @cnip = split (\/\:/, $datb); print "\n ===================================== +===\n"; print " NPANXX Line Switch MSR&CUSTGP VMX"; print " $cnip $cnip[1] $cnip[2] $cnip[3] $cnip[4] $cnip +[5]"; print " ======================================= +=\n\n"; } } else { ### you has this left bracket way up under your 'if' print "\nValid NPANXX not entered!\n"; }
|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Checking Input using reg exp.
by Beatnik (Parson) on Dec 28, 2001 at 18:03 UTC | |
|
Re: Re: Checking Input using reg exp.
by defyance (Curate) on Dec 28, 2001 at 07:09 UTC | |
by shockme (Chaplain) on Dec 28, 2001 at 09:30 UTC | |
by gav^ (Curate) on Dec 28, 2001 at 19:55 UTC |