Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: Data extraction from text file

by Eliya (Vicar)
on Aug 09, 2011 at 11:49 UTC ( #919458=note: print w/ replies, xml ) Need Help??

in reply to Re: Data extraction from text file
in thread Data extraction from text file

Alternatively, you could set the input record separator ($/) to "-------", which simplifies things a bit:

$/ = "-------\n"; my @records; while (<>) { my @entries = map { /([^:]+):\s*(.*)/ } split /\n/; push @records, { @entries } if @entries; }

Comment on Re^2: Data extraction from text file
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2015-11-29 01:15 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (746 votes), past polls