in reply to upto match please, my one-lina!!

perl -ne 'BEGIN { $pat = qr/.../; $size = (N-1) } @_ = ($_, @_[0 .. ($ +#_ > $size ? $size : $#_)]); print reverse @_ if /$pat/'

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^2: upto match please, my one-lina!!
by Firefly258 (Beadle) on Jun 09, 2006 at 02:01 UTC
    Jeff, Thanks for pointing $# out .. didnt realize that one. Errm, i dont see the point to the code .. seems like a long way around
    perl -ne 'print if /(?-xism:.{3})/'
      Huh? I presented code that prints N lines before a matching line.

      Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
      How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart