in reply to Re: Grab 3 lines before and 2 after each regex hit
in thread Grab 3 lines before and 2 after each regex hit

Your techinque answers the need nicely...
thank you

for(1..$#lines)
{
    if($lines$_=~m/^\d+\d+/){
         print qq~
....... ...         
         ~;

I guess that `pp~' operates something like a here document?
Can you explain a bit?

  • Comment on Re^2: Grab 3 lines before and 2 after each regex hit

Replies are listed 'Best First'.
Re^3: Grab 3 lines before and 2 after each regex hit
by choroba (Cardinal) on Apr 25, 2014 at 19:36 UTC
      http://perldoc.perl.org/perlop.html#Quote-Like-Operators

      Egad... I understood about 1/10 of a percent of that.

      I see the authors have made a fairly extensive effort to make the explanations readable... but still seems aimed at an audience several good steps above me. Or possibly just a few layers less of `thickskulledness'.

      Finally resorted to skipping thru and reading every place qq appears. However, I came away mostly with my poor pea brain swimming.

      I never really recognized your usage in those pages.

      One small thing that did stay with me:
      qq means what follows is interpolated... beyond that and even that itself, sails right over my head.

        Do you understand how '...' and "..." work in Perl? q() and qq() work pretty the same way, respectively. "Interpolation" just means some characters have special meaning (\, $, @ to name a few).
        لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ