Just a small correction to above perl snipplet. As far as my understanding we cannot decalre $_ as "my" since its a special global variable. This code will throw a compilation error in this case. We need to declare $_ as local to work it in proper way.
I would rather suggest using following code:-
use strict; my $str_xml='<xml> <email>toto@foo.com</email><name>Toto</name> <email>tata@bar.com</email><name>Tata</name> <email>tutu@baz.com</email><name>Tutu</name> </xml>'; my @email = ($str_xml =~ /<email>(.*?)<\/email>/g); my @name = ($str_xml =~ /<name>(.*?)<\/name>/g); print "email: @email\n"; print "name: @name\n";
In reply to Re: Strip that XML!
by perl_addict
in thread Strip that XML!
by redbeard
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |