http://www.perlmonks.org?node_id=1029948

Doozer has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am using Test::More along with WWW::Selenium to automate some router GUI browsing. One thing I am trying to do is use Test::More's "like" function to check that certain contents on the web page match a regular expression.

For example I want run the contents of a web element where the router's wireless SSID is shown against a regex and then print the match so the code would look something like:

like($sel->get_value("name=wlSsid_wl0v0"), qr/\S{1,}/, "1000.0362 SSID was displayed on the wireless settings page \($&\)");

I would like to be able to use the various local special variables in perl such as $& and $1,$2 etc so that I can print what the script finds against the regex pattern match, but they dont seem to work. I'm guessing this a localisation issue? Any help would be much appreciated and I can provide more info if needed.