in reply to Re: print matching lines
in thread print matching lines

sorry yes, # input 2 xxx yyyy 1 so with $/ set to # input it would be possible to do a pattern search and print the match?

Replies are listed 'Best First'.
Re^3: print matching lines
by davidrw (Prior) on Jul 10, 2005 at 20:12 UTC
    yes, that's why i suggested it .. I would (you ignored my questioned about providing code, so i'll continue just guiding with pesudo code until you have something to work from) set $/, then loop through the 'lines' (which will contain multiple \n newlines). During this loop, split on newline to get your array of 4 lines. Note the first one will be just a number (the remainder of the '# input 3' line) and the last one will be '# input ' ($/).
Re^3: print matching lines
by Anonymous Monk on Jul 10, 2005 at 19:24 UTC
      while (<FH>) { local $/ = '# input'; if (m/1ord/) { print "$/\n";} }
      this prints the local variable, how can i adjust it to print the enitre # input line?