Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Perl script to print Next line after Pattern Matching

by si_lence (Deacon)
on Dec 20, 2011 at 14:20 UTC ( #944402=note: print w/ replies, xml ) Need Help??


in reply to Perl script to print Next line after Pattern Matching

Not as compact as the answer of mr.nick. This might be an advantage or not, you decide ..

use strict; use warnings; my $print_flag = 'N'; while (<DATA>) { if ($print_flag eq 'Y') { print; $print_flag = 'N'; } $print_flag = 'Y' if m/^Customer ID: Yes/; } __DATA__ Customer ID: none VT : 002/89 Customer ID: Yes VT: 001/89 Customer ID: none VT: 006/85 Customer ID: Yes VT: 003/56


Comment on Re: Perl script to print Next line after Pattern Matching
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://944402]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2014-08-21 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (127 votes), past polls