Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://399813]
help
Chatterbox?
[erix]: spies should use a type-writer, no power needed, no auditable
[erix]: if all else fails, eat the paper
[erix]: a few years ago there was suddenly the news that the Kremlin was using typewriters again. Heard nothing about it afterward
[erix]: (maybe that means it worked)
[oiskuu]: Yeah, it might work as long as there are no root exploits. ;-)
[Corion]: Also, it's much harder to leak paper sheets than it is to leak documents that are available electronically
[oiskuu]: tye, do you make use of remote logging?
[oiskuu]: erix, this gives a new definition to e-paper: something that records the pressure imprints and is bluetooh capable, looks like ordinary paper.

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2017-06-23 20:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (555 votes). Check out past polls.