Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Parsing file to pull out sections of text

by artist (Parson)
on Feb 03, 2009 at 20:46 UTC ( [id://741121]=note: print w/replies, xml ) Need Help??


in reply to Parsing file to pull out sections of text

use strict; use warnings; my $flag = 0; my $start = 'd1'; my $end = 'd4'; my @array; while (<DATA>) { chomp; if(/$start/){ $flag = 1; @array = (); } elsif(/$end/) { $flag = 0; print "@array\n"; } else{ push @array, $_ if $flag; } }
--Artist

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-24 17:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found