use Data::Dump; my $h; my @a; while(<DATA>) { if (/^object (.*)/) { $h = {}; push @a,$h; $h->{object} = $1; } $h->{$1} = $2 if /^\s+(\w+) (.*)/; } 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
[ { description => "Help Desk Ticket #476739", host => "138.108.25.111", object => "network Microsoft.Lync.Host.3", }, { description => "Help Desk Ticket #476739", host => "138.108.25.112", object => "network Microsoft.Lync.Host.4", }, { description => "Help Desk Ticket #476739", host => "138.108.25.113", object => "network Microsoft.Lync.Host.5", }, { object => "network Microsoft.Lync.Host.6" }, ]
Cheers Rolf
( addicted to the Perl Programming Language)
In reply to Re: Extract Data Between Lines
by LanX
in thread Extract Data Between Lines
by namelkcip
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |