On Mar 4, 11:47 am, stufor...@gmail.com (Sf) wrote: > this is my problem: variable theParent never updates - it always stays > "1" > > if ($ARGV[0] eq ""){ > print STDOUT "Enter the filename and path you wish to use:"; > $nameoffile=<STDIN>; > }} > > $theHL = 1; > $theParent = "1"; > > open (FILENAME, "$nameoffile") or die "cant open file\n"; > open (TOFILE,">builtFile.txt"); > > #initialize variable and assure it is global to the entire program > > #read through the original file > while ($line = <FILENAME>){ > > my($theParent)="1"; > > #split the file by *'s and put each 'split' into a node of array > @array > @array=split(/\*/,$line); > > if (@array[0] eq "HL") { > if (@array[3] eq "20") { > my($theParent) = $array[1]; > $line = "@array[0]*$theh...@array[3]*@array[4]"; > $theHL = $theHL + 1; > } > } > if (@array[0] eq "HL") { > if (@array[3] eq "22") { > $line = "@array[0]*$thehl*$thepare...@array[3]*@array[4]"; > $theHL = $theHL + 1; > } > } > > $line =~ s/$/~/; > if ($line ne "~\n") { > print TOFILE $line; > }
got it... thanks for looking... -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/