Hey all,
I have a prob. Please look at this error and tell me what I'm doing wrong, I keep getting:
Use of implicit split to @_ is deprecated at npa line 16.
syntax error at npa line 22, near "else"
Execution of npa aborted due to compilation errors.
I am VERY new, and I can't seem to get this down, probably something to do with the reg exp I'm trying to use. All I want it to do it spit out an error when a letter is inputed.
I want it to read 6 numbers, pull the numbers from the file, then spit it out. But if a letter is inputed, I want it to error out. If I take out the if & else, it works, but if I hit a letter it spits out
all the data in the file, thats 216 lines, toooo much.
VERY MESSY CODE WARNING.
#!/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`;
\@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 {
print "\nValid NPANXX not entered!\n";
};
I know I'm probably gonna lose exp points for this one, but I really need help. Code is very ugly, but it spits out the data quite nicely when it works right!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.