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

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 138.108.25.111 description Help Desk Ticket #476739 object network Microsoft.Lync.Host.4 host 138.108.25.112 description Help Desk Ticket #476739 object network Microsoft.Lync.Host.5 host 138.108.25.113 description Help Desk Ticket #476739 object network Microsoft.Lync.Host.6


Comment on Re: Extract Data Between Lines
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2015-07-29 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (267 votes), past polls