Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Copy Lines After Match

by 2teez (Vicar)
on Dec 18, 2015 at 07:09 UTC ( #1150670=note: print w/replies, xml ) Need Help??


in reply to Re: Copy Lines After Match
in thread Copy Lines After Match **UPDATE**

Hi vinoth.ree

Am sure you know one can achieve the OP intended output without so much elaborate solution. like so:
use warnings; use strict; while (<DATA>){ print unless /computer.|^\s+$/i; } __DATA__ COMPUTER1 ACCT1 ACCT2 ACCT3
One can even take out the while loop and use grep like so:
print grep{!/computer.|^\s+$/i}<DATA>;
These gives the output:
ACCT1 ACCT2 ACCT3 ACCT4 ACCT7 ACCT8 ACCT9
@jalopez453,
Please also note that the filehandle is written as __DATA__, double "_" not a single dash as did.
Cheers!
If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Replies are listed 'Best First'.
Re^3: Copy Lines After Match
by GotToBTru (Prior) on Dec 18, 2015 at 16:02 UTC

    This assumes the data is really as simple as indicated, so that the question posed by the OP title is not really relevant. For the benefit of others who might find this thread by searching, the more detailed program is necessary.

    Dum Spiro Spero

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2021-04-17 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?