See the codes below. The trick here is that $& is an special var used
to capture the total match string.
So in this case, the /[$&]/ regexp literal is equal to /
[.type=xmlrpc&]/.

#!/bin/perl
$url = 'http://abc.com/test.cgi?TEST=1&.type=xmlrpc&type=2';
($r1) = $url =~ /\.type=(.+?)(&|$)/;
print "\$&=$&\n";
($r2) = $url =~ /\.type=(.+?)[$&]/;

print "\$r1=$r1\n\$r2=$r2\n"

__DATA__
$&=.type=xmlrpc&
$r1=xmlrpc
$r2=x


-Todd


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to