Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Logic trouble parsing a formatted text file into hashes of hashes (of hashes, etc.)

by ambrus (Abbot)
on Oct 16, 2004 at 20:31 UTC ( #399813=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    use Data::Dumper; $s = \%p; @s = (); while (<>) { while (/\G\s*(?:([-\
    +w.]+)|:([-\w.]+)\s*\(|(\)))/gc) { if (defined($1)) { defined($$s{""})
    + and die "parse error: two"; $$s{""} = $1; } elsif (defined($2)) { pu
    +sh @s, $s; $s = $$s{$2} = {}; } elsif (defined($3)) { @s or die "pars
    +e error: close"; $s = pop @s; } } /(\S.*)/g and die "parse error: jun
    +k: $1"; } $! and die "read error"; $s == \%p or die "parse error: ope
    +n"; print Dumper(\%p);

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://399813]
[thepkd]: Hi, in trying to create an Array of Hash of Array of Hash. You read it right. Is it possible to dereference it without using temps?
[GotToBTru]: what are temps?

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2016-12-06 13:12 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (104 votes). Check out past polls.