in reply to How to read lines from a file which is....
Update: Or, more concisely (but less readable at-a-glace)...#!/usr/bin/perl -w use strict; my (@desc, @data); while (<DATA>) { next if /Description:/; last if /Data:/; push @desc, $_; } @data = <DATA>; # DONE. Check results: print "desc array\n", @desc; print "data array\n", @data; __DATA__ Description: yada_d1 yada_d1 yada_d1 yada_d1 Data: yada_d2 yada_d2 yada_d2 yada_d2
my (@desc, @data); my $line = <DATA>; # Throw away first line push @desc, $line while ($line = <DATA>) !~ /Data:/; @data = <DATA>;
------------------------------------------------------------
"Perl is a mess
and that's good because the
problem space is also a mess." - Larry Wall
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to read lines from a file which is....
by rbc (Curate) on Jan 04, 2002 at 05:04 UTC |