Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Extract Data Between Lines

by hdb (Prior)
on Apr 04, 2014 at 12:59 UTC ( #1081122=note: print w/replies, xml ) Need Help??

in reply to Extract Data Between Lines

...and here is my favorite way of doing it...

use strict; use warnings; use Data::Dumper; my @data; while(<DATA>){ push @data, { object => $1 } if /^object (.*)/; $data[-1]->{$1} = $2 if /^ (.*?) (.*)/; } print Dumper \@data; __DATA__ object network Microsoft.Lync.Host.3 host description Help Desk Ticket #476739 object network Microsoft.Lync.Host.4 host description Help Desk Ticket #476739 object network Microsoft.Lync.Host.5 host description Help Desk Ticket #476739 object network Microsoft.Lync.Host.6

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1081122]
[Corion]: shmem: Yes, very sad!
[choroba]: doesn't sound much useful, which means I'll probably remember it
[karlgoethebier]: "that blue pain" == Salzglasur as far as i remember
[karlgoethebier]: Paint!
[shmem]: karlgoethebier the blue pain comes after all bembels are empty
[karlgoethebier]: Confusing "Bembel" with "Membel" might result in a slap in the face in Hesse...
[karlgoethebier]: shmem: Yes. Greetings from Dr. Freud
[Discipulus]: blue pain is a synōnymía

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2017-05-24 08:57 GMT
Find Nodes?
    Voting Booth?