XP is just a number | |
PerlMonks |
Re: getting error "Use of uninitialized value $lines in concatenation (.) or string at line 6"by Athanasius (Archbishop) |
on Jul 03, 2014 at 02:54 UTC ( [id://1092079]=note: print w/replies, xml ) | Need Help?? |
Hello chiru, and welcome to the Monastery! There are two major problems in your script:
Note also that $ARGV has a special meaning in Perl (see perlvar#Variables-related-to-filehandles). You should use an ordinary lexical variable instead: chomp(my $file = <>); And of course the design of this script is inefficient, since it reads the file twice. See NetWallah’s answer for a better, one-pass, approach. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|