Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Extract Data Between Lines

by LanX (Canon)
on Apr 04, 2014 at 02:52 UTC ( #1081062=note: print w/ replies, xml ) Need Help??


in reply to Extract Data Between Lines

TIMTOWTDI :)

use warnings; use strict; use Data::Dump; my $h; my @a; while(<DATA>) { if (/^object (.*)/) { if ($h) { push @a,$h; undef $h; } $h->{object}=$1; } $h->{host} = $1 if /^\s+host (.*)/; $h->{description} = $1 if /^\s+description (.*)/; } push @a,$h if $h; dd \@a; __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

Cheers Rolf

( addicted to the Perl Programming Language)


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://1081062]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2014-08-27 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (237 votes), past polls