[tpm] Skip lines when "perl -wn"

Antonio Sun tpm.ats at spamgourmet.com
Thu Apr 2 08:51:56 PDT 2015


Please disregard the following email as I've found the problem -- I was
doing "<>" but checking on "$_", which isn't affected by "<>".

On Thu, Apr 2, 2015 at 11:00 AM, Antonio Sun <tpm.ats at spamgourmet.com>
wrote:

> The "-n" causes Perl to assume a loop around the program, which makes it
> iterate over filename arguments somewhat like `sed -n` or awk.
>
> Now, is it possible to skip some lines myself in such "perl -wn" script?
>
> #!/usr/bin/perl -wn
>
> if (/my case/) {
>   # Skip two lines
>   <>; <>;
>   # Deal with the rest
> }
>
>
> The above is not working for me. $_ is stuck at the same line/content.
>
> How to skip some lines in such "perl -wn" script?
>
> Thanks
>
> Antonio
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20150402/ec90ff25/attachment.html>


More information about the toronto-pm mailing list