[tpm] Skip lines when "perl -wn"
G. Matthew Rice
matt at starnix.com
Thu Apr 2 08:33:18 PDT 2015
On Thu, Apr 2, 2015 at 11:00 AM, Antonio Sun <tpm.ats at spamgourmet.com> wrote:
> Now, is it possible to skip some lines myself in such "perl -wn" script?
Do you mean like this:
#!/usr/bin/perl -wn
BEGIN { our $skipping = 0; }
if (/c/ || $skipping) {
$skipping = 1 - $skipping;
next;
}
print;
__END__
The script and sample data is attached.
--
G. Matthew Rice <matt at starnix.com> gpg id: EF9AAD20
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.pl
Type: text/x-perl-script
Size: 132 bytes
Desc: not available
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20150402/a60ac08e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.dat
Type: application/octet-stream
Size: 15 bytes
Desc: not available
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20150402/a60ac08e/attachment.obj>
More information about the toronto-pm
mailing list