in reply to Checking Input using reg exp.
Just a guess...#!/usr/local/bin/perl use strict; #$cnip = $ENV{'QUERY_STRING'}; #Uhm where is this coming from??? print "\n"," "x22,"Look Up NPANXX Info\n"; print " "x19,"="x30,"\n"; print " "x19,"Please enter NPANXX:"; my $cnip; chomp($cnip=<STDIN>); if($cnip =~ /\d{6}/){ &npa1 } else{ print "\n"," "x21,"Valid NPANXX not entered!\n"; } sub npa1 { open(TECH,"<tech3") || die "Oops : $!"; while(<TECH>) { if (/$cnip/) { my (@cnip) = split(/\:/); print "\n"," "x16,"="x40,"\n"; print " "x16,"NPANXX Line Switch MSR&CUSTGP VMX"; print " "x16,"$cnip $cnip[1] $cnip[2] $cnip[3] $cnip[4] $c +nip[5]"; print " "x16,"="x40,"\n\n"; } } close(TECH); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Checking Input using reg exp.
by defyance (Curate) on Dec 28, 2001 at 23:39 UTC |