in reply to regex matching issue

Using regular expressions to parse XML is more trouble than it's worth (see XML parsing vs Regular expressions). Consider using a parser such as XML::Twig:
use strict; use warnings; use XML::Twig; my $xmlStr = <<XML; <item name="pdf_link"> <value>http://www.yahoo.com</value> </item> XML my $twig= XML::Twig->new( twig_handlers => { item => \&item } ); $twig->parse($xmlStr); sub item { my ($twig, $item) = @_; if ($item->att('name') eq 'pdf_link') { print $item->first_child('value')->text(), "\n"; } } __END__ http://www.yahoo.com