> -----Original Message----- > From: Lance Prais [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, December 26, 2001 7:16 PM > To: [EMAIL PROTECTED] > Subject: searching a sub string > > > > Am I understanding this correctly that if I put in the > following code the > result will be it will start reading on row 23? > > For the print output I am getting the following. > line: (substr(1, 42, 7) > > Which leads me to believe that it is starting on line 1. > > Can anyone see what I am doing wrong? > > for(my $i=0; $i<22; $i++){<EMAILMGR>}; #This will put > you at row 23.----
A more "perlish" way to read 22 lines would be: <EMAILMGR> for 1..22; > $_=<EMAILMGR>; > my $line=$_; > my $nextline=$line++; The expression $line++ is destroying the previous value of $line as read from the file, and setting it to the numeric value 1. What are you trying to accomplish here? > if (substr($line, 42, 7) eq "Running") > { > print STDERR "\nline: (substr($line, 42, 7)"; You cannot (easily) interpolate a function call inside double quotes. You need to use: print STDERR "\nline: ", substr($line, 42, 7); > } > Else case-sensitive: needs to be "else". Did you actually run this? > { > print STDERR "\nline: (substr($line, 42, 7)"; > } The "if" and "else" cases are identical. What are you trying to accomplish here? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]