[tpm] Skip lines when "perl -wn"

Antonio Sun tpm.ats at spamgourmet.com
Thu Apr 2 08:00:50 PDT 2015


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/a3738e95/attachment.html>


More information about the toronto-pm mailing list