Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Convert Tcl Keyed List to Perl (Tkx, dadum, t2p)

by Anonymous Monk
on May 23, 2013 at 03:44 UTC ( #1034854=note: print w/ replies, xml ) Need Help??


in reply to Re: Convert Tcl Keyed List to Perl (Tkx, dadum, t2p)
in thread Convert Tcl Keyed List to Perl

Shows how well I know tcl (i dont)

use Regexp::Common; sub t2p { local $_ = $_[0]; my $last = my $root = []; my @prev; pos($_)=0; while( length > pos ){ if( m{ \G \s+ }gscx ){ next; # ignore space } elsif( m{ \G \{ }gscx ){ push @$last, my $new = []; push @prev, $last; $last = $new; } elsif( m{ \G \} }gscx ){ $last = pop @prev; #~ } elsif( m{ \G ( [^\s\{\}]+ ) }gscx ){ } elsif( m{ \G ( $RE{quoted} ) }gscx ){ push @$last, $1; #~ } elsif( m{ \G ( [^\s\{\}]+ ) }gscx ){ } elsif( m{ \G ( [^\{\}\\]+ | \\[\{\}] ) }gscx ){ push @$last, $1; } elsif( m{ \G (.) }gscx ){ push @$last, { error => $1 }; } } $root }


Comment on Re^2: Convert Tcl Keyed List to Perl (Tkx, dadum, t2p)
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2014-07-26 08:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls