>>>>> "CS" == Chris Stinemetz <cstinem...@cricketcommunications.com> writes:
CS> 5 # Intialization begins as i said elsewhere, don't declare vars before you need them. it is noisy and in many cases redundant. CS> 6 CS> 10 my $line =''; CS> 21 my @val = (split /:/, $line); what do you think that line does? $line is empty. why split it now? that expression will only happen ONE time. my ESP says you are thinking it will happen whenever @val is used later on. CS> 22 CS> 23 # Initialization ends CS> 24 CS> 25 #Get data from EVDOPCMD.txt file and output to processed.txt file. CS> 26 CS> 27 print "What file do you want to parse?"; CS> 28 $filename = <STDIN>; CS> 29 CS> 30 open($in, '<', $filename) or die("Can't open $filename for reading: $!"); filename will have a newline on it. chomp it first or your dir listing will be wacky and hard to deal with. p CS> 31 open($out, '>', $outputfile) or die("Can't create file $outputfile: $!"); CS> 32 CS> 33 #split by line CS> 34 while( my $line = <$in> ) { you declared line earlier. why? as i said drop the early declarations as they are mostly not needed. CS> 35 chomp($line); CS> 36 my @fields = (); CS> 37 my @val = (); same for those vars. don't declare them earlier as they aren't used there and that confuses the reader. CS> 38 } on top of that you declare those inside a block and NEVER use them in this block. you need to learn about scoping and declarations. you are just guessing with this now. CS> 40 #Extract the data you want into named variables: CS> 41 CS> 42 # my( $version, $mtype, $rlptxat, $cell, $sector ) = @fields[0,5,44,31,32];@val = split (/;/, $line); where did @fields get set? don't put two lines of code on one line. it was set INSIDE the block and declared there. so its data is lost when you exited the block. 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/