On Jul 12, Ling F. Zhang said:
>I am doing an xml parser to manage my list of
>mp3s...say after reading my xml file, my variable
>reads:
>$tmp = '<artist>artist#1</artist>
><title>songtitle</title>...'
It might be wiser to use a real XML parser (written in Perl, of course)
instead of writing your own regexes to deal with your input.
>$tmp =~ /<artist>.*?<\/artist>/;
>$artist = substr($tmp,$-[0]+8,$+[0]-$-[0]-9);
How on EARTH did you learn about the @- and @+ arrays, WITHOUT learning
about the $1, $2, $3, etc. variables? Honestly, which regex tutorial have
you been using?
You probably want to use capturing parentheses:
($artist) = $tmp =~ m{<artist>(.*?)</artist>};
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]