okay i don't know how much you know or how much help you want...
i wrote that just now and didn't test it, but it looks good to me. let me know if you need more help, or help opening all files in a directory or something.Code:# first you need to open the file: open(A, "<file.xml"); #open file.xml for reading open(TITLES, ">>titles.txt"); #open titles.txt for writting, in append mode as to not wipe it each time this is run. #now we want to read from it until we get an end of file, or a title tag while(<A>) { if(/<Title>(.*?)</Title>/i) { #ahh beautiful regex. i suggest running perldoc perlre so you can read more about it # but basicly this says search for <Title> and capture everything in between (.*?) # followed by a </Title>. and /i means ignore case print TITLES "$1\n"; last; #break out of the loop, only one Title per file. } }
good luck


Reply With Quote
Bookmarks