>>>>> "JH" == Jugurtha Hadjar <jugurtha.had...@gmail.com> writes:
JH> I rewrote your code and at the very beginning, just before any JH> variable was /used/ [i.e, just after "use strict", I added this is very overkill and in some cases wrong. in general declare variable just when they are needed. when i see a long list of declarations at the beginning of a file, i know it can be improved. JH> # Intialization begins JH> my $cell =''; JH> my $filename =''; JH> my $in =''; JH> my $line =''; JH> my $mtype =''; JH> my $out =''; JH> my $outputfile ="processed.txt"; JH> my $rlptxat =''; JH> my $sector =''; JH> my $version =''; why always ''? some may be better with 0. i haven't looked at the data needs yet. JH> my @data =0; JH> my @fields =0; JH> my @val =0; that has to be wrong. that is setting the arrays to a list with the element 0, not an empty list. JH> # Initialization ends useless comment. JH> I also changed JH> open( my $in, '<', $filename) or die("Can't open $filename for JH> reading: $!"); JH> open( my $out, '>', $outputfile) or die("Can't create file $outputfile: $!); JH> Into : JH> open($in, '<', $filename) or die("Can't open $filename for reading: $!"); JH> open($out, '>', $outputfile) or die("Can't create file $outputfile: $!); JH> Because there was an error that said they masked "earlier declaration JH> in same scope" again, why? if you don't predeclare it, then a my handle works fine. and the variable is declare where it is first used which is better. why waste lines of code for no reason. also the second open there is missing a close ". uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/