while ( $token=$p->get_token() ) { if ($token->is_start_tag('img') ) { my $src = $token->return_attr->{src}; print "SRC IS $src\n"; #For Debugging $src =~ s/$src/$newsrc/; print "SRC NOW: $src\n"; #For Debugging $token->set_attr('src', $src); } #### got filetitle: ApplePecanBreadStuffing SRC IS ../../images/dbimage.asp?ID=751 SRC NOW: ../../images/dbimage.asp?ID=751 SRC IS ../../images/spacer.gif SRC NOW: 'ApplePecanBreadStuffing.jpg' SRC IS ../../images/spacer.gif SRC NOW: 'ApplePecanBreadStuffing.jpg'