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

Re: Re: •Re: XML::Parser and Invalid XML

by runrig (Abbot)
on Jul 17, 2002 at 23:02 UTC ( #182632=note: print w/replies, xml ) Need Help??


in reply to Re: •Re: XML::Parser and Invalid XML
in thread XML::Parser and Invalid XML

This could be better, but you get the idea, just copy the hash with a tacked on token to all the hash keys.
my %hash = qw(1 a 2 b 3 c); my $fixed_href = {}; fix_hash(\%fix_hash, $fixed_href); sub fix_hash { my ($old, $new) = @_; while (my ($key, $value) = each %$old) { (my $nkey = $key) =~ s/^(?=\d)/N/; if (ref($value) eq 'HASH') { $new_value = {}; $new->{$nkey} = $new_value; fix_hash($value, $new_value; } else { $new->{$nkey} = $value; } } }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2021-09-20 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?