Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Data Structure help

by fruiture (Curate)
on Mar 21, 2003 at 20:40 UTC ( #244999=note: print w/ replies, xml ) Need Help??


in reply to Data Structure help

Hmmm...

my %all_the_stuff = (); my $current; while( <> ){ chomp; next unless length; if( m/^KEY: (.+)/ ){ $current = { OID => [], #you migth want to put these two NAME => [], # together, i don't know ERROR => undef, }; $all_the_stuff{ $1 } = $current } next unless $current; if( m/^(OID|NAME): (.+)/ ){ push @{$current->{$1}},$2 } elsif( m/^Error Status (.+)/ ){ $current->{ERROR} = $1; $current = undef; #error status is final statement } }

See perlref,perllol, perldsc and perhaps perlre. The code is untested and not to be used without careful analysis.

--
http://fruiture.de


Comment on Re: Data Structure help
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2015-07-28 22:18 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 (260 votes), past polls