Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Parsing file to pull out sections of text

by artist (Parson)
on Feb 03, 2009 at 20:46 UTC ( #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


Comment on Re: Parsing file to pull out sections of text
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2014-11-27 19:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (187 votes), past polls