in reply to Test::More not working with Perl local special variables

This is a timing thing. Your double-quoted string "1000.0362 SSID was displayed on the wireless settings page \($&\)" is interpolated before like is called; then the regexp match happens inside the like call.

So when the interpolation happens, $& is still undefined.

The following might work:

like($sel->get_value("name=wlSsid_wl0v0"), qr/\S{1,}/, "1000.0362 SSID + was displayed on the wireless settings page") and diag("got: $&");
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Replies are listed 'Best First'.
Re^2: Test::More not working with Perl local special variables
by Doozer (Scribe) on Apr 23, 2013 at 07:01 UTC
    Thank you for the responses on this. I had a bad feeling I wasn't going to be able to use them in this way. I tried tobyink's suggestion but it still doesn't work. I think I can work around it but it turns 1 line of code in to about 6. Thanks again :)