The question is a bit fuzzy, but try this at the command line, just for fun:
perl -e 'my $line = "abrabracadabra";print $line++, " ", $line, "\n";'

then consider this:

#!D:/cygwin/bin/perl
my ($i, $line, $nextline);
open (TEXTF, "c:/temp/somelines.txt") or die "Evil forces keep me for doing
what you want:$!\n";
while(<TEXTF>) { # while construct automatically use $_
 $i++;
 next if ($i < 23); # fast forward to line 23
 if (/Running/ and not $line) {  # this is a regex but your substr function
should work here if you need to pick
      # up Running at a specific location in the line
  $line = $_; # saves the first line with Running in it that occurs after
line 22
  print"Target found on line $i\n";
  next; # because we cannot allow next if to execute now
 }
 if (/Running/ and $line) { # running is found AND $line is not null
  $nextline = $_;
  last; # I am assuming you want the first line with target string Running
in it and the very next
 }       # line (and only the next line) if it has running in it
}
close TEXTF;
print "$line\n$nextline\n";

HTH

Frank McCollum <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am not sure, but I think it has to do with $nextline=$line++;  It sounds
> like $line is a text string and you are autoincrementing it here?  Maybe
> what you really want is $nextline++; to count the number of lines?
>
> -----Original Message-----
> From: Lance Prais [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 08, 2002 11:49 AM
> To: [EMAIL PROTECTED]
> Subject: If...Statement
>
>
> I am trying to start on a specific line of code and read a sub string of
> that code and also read the next line in the sequence and a sub string of
> that line.  If either of the values are false then do something.
>
> I am using the following code:
>
> for(my $i=0; $i<22; $i++){<WORKFLOW>}; #This will put you at row 23.----
>   $_=<WORKFLOW>;
>   my $line=$_;
>   my $nextline=$line++;
> if ((substr($line, 42, 7) eq "Running") || (substr($nextline, 42, 7)eq
> "Running"))
>
> Can anyone see what I am doing in correct?
>
>
> Thanks
> Lance Prais
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to