just a short followup to my earlier message about the $. line number variable. when i enter a print statement as shown below, it prints the correct line number (starting at 1), but still never enters the if() structure.
for the sake of understanding how to correctly use this variable, i would really like to get this code working. if i can't, then i will use one of the workarounds that others on this list have suggested to me. is there something special about the way the if() structure has to be phrased, other than the way i have it? thanks joe > while (<fh1>) { > chomp ; print $. ; # prints correct line numbers starting at 1 print "\n" ; print $_ ; # prints each line of input file, starting at 1 print "\n" ; > if ($. == 1 ) { # is this phrased correctly??? > my @initial_values = split / /, $_ ; > # process intial values here > } > > if ($. > 1) { > #process subsequent values here > } > > } # end of while loop On Monday 08 November 2004 10:29, Joseph Paish wrote: > how do you use the "line number" variable inside a while loop like i am > trying to do below? > > i never get to process the first line of the file, and as a result, > subsequent calculations are inaccurate. it always jumps to the second "if" > statement. > > thanks > > joe > > ========= -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>