in reply to Re^3: Help editing a file based off seach criteria
in thread Help editing a file based off seach criteria

Same thing here, this tells me each time what line the search criteria will be in, even when the file grows, but how do I jump up one line if the pattern is matched?
#!/usr/bin/perl open DATA, "</home/file.conf"; while (<DATA>) { if(m/\END\b/) { print "$.\n"; } } close(DATA);

Replies are listed 'Best First'.
Re^5: Help editing a file based off seach criteria
by Corion (Patriarch) on Jan 13, 2009 at 15:55 UTC

    Now, what line number could the line have that is right before the current line (whose number you know)?

      pos--;

        In your program you posted above, where did you use pos?

        Also, the pos function does not do what you might think what it does.