Perl-Sensitive Sunglasses | |
PerlMonks |
Munging a XML databy mexnix (Pilgrim) |
on Aug 06, 2001 at 23:14 UTC ( [id://102558]=perlquestion: print w/replies, xml ) | Need Help?? |
mexnix has asked for the wisdom of the Perl Monks concerning the following question:
Right now I'm developing a "news" kinda thing for a site I'm working on, and if it works well (a relative term), I may use it else where. I'm using XML to create "news listing" and post them on the front page of the site. Thank God for XML::Simple! It make the conversion process very...well, simple. My problem is in-between convertions. First I parse my XML file into a ref (my $data = XMLin('./this.xml')). Data::Dumper would print something like this:
Then I want to be able to delete a user specified ($match) entry from the file (perl psuedo-code: DELETE ENTRY from $data->{news} WHERE ENTRY->{title} is $match). I'm confused on how to do this because 'news' is an anon array of hashrefs. I tried a few things, but my only real idea would be to shift each entry individually see if they match, then push them back if I don't want to delete them. There has got to be a better way. __________________________________________________
Back to
Seekers of Perl Wisdom
|
|