I have been trying for hours, to make this data structure into hash, I need 
help. Thanks.

$str = 
"
    (dr1
        <predicate>foo
        <1>(dr2 <predicate>bar) 
        <2>a
    )
";

$hash = {
    "dr1" => {
            "<1>" => {"dr2" => {"predicate"=> "bar"}},
            "<2>" => "a"
    }
};

dr1 and dr2 is a unique reference, the argument could nothing until arbitarily 
long <[0-9]+>, the argument value is actually a repeating pattern of the whole 
pattern.
The whole pattern is 
$pattern = 
/
\(
      [a-z0-9]+   \s+ <predicate>[a-z]+ \s+ (<[0-9]+>$pattern)*
\)
/x

What could be the regular expression and algorithm to make the resulting hash ? 

Thanks.


      Get your new Email address!
Grab the Email name you&#39;ve always wanted before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to