Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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 wandering the Monastery: (8)
As of 2015-07-05 10:17 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 (61 votes), past polls