Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Command output into a hash of hash

by bichonfrise74 (Vicar)
on Nov 20, 2009 at 01:05 UTC ( #808312=note: print w/replies, xml ) Need Help??


in reply to Command output into a hash of hash

Another way...
#!/usr/bin/perl use strict; use Data::Dumper; my %record; my $name; while (<DATA>) { if ( /Name: / ... /\n\n/ ) { s/Name:\s*(.*)// and $name = $1; my ($key, $val) = split( /\s+/ ); push( @{ $record{$name}->{$key} }, $val ); } } print Dumper \%record; __DATA__ Name: LUN 120 DB CloneGroupUid: 50:06:01:60:BC:E0:26:09:03:00:00:00:00:00:00:00 InSync: Yes ...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://808312]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2018-06-20 16:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (116 votes). Check out past polls.

    Notices?