Syntactic Confectionery Delight | |
PerlMonks |
Will regex work here?by Sherlock (Deacon) |
on Apr 25, 2001 at 00:11 UTC ( [id://75246]=perlquestion: print w/replies, xml ) | Need Help?? |
Sherlock has asked for the wisdom of the Perl Monks concerning the following question:
I'm rather new to Perl development and I've come across a situation where I think the use of some sort of regex might work, but I'm not very good with them yet, so I need a little help. Here's the situation. I'm reading a list of appointments from an XML file and I'd like to remove any old dates from the file. Here's a sample of the XML to show you the schema: What I'd like to accompish is to read this file in (possibly into a single scalar, for simplicity) and remove all <DAY> nodes with a "DATE" attribute prior to a specific date, such as the current date. I was thinking of using some permutation of the s/// operator to accomplish someting like: This is where I'm having trouble. Can I use some sort of regex to pull this off or is there possibly another, simpler way of accomplishing this. Thanks, - Sherlock P.S. I'd like to send a little "Thank you" out to OeufMayo for the XML::Parser Tutorial that really got me going on this project. ;-)
Back to
Seekers of Perl Wisdom
|
|