##
( "hello Gags" =~ /^(?=hello)(?!.*Ga/ )&& print ("Matched") || print ("Unmatched")
##
##
use strict;
( "hello Gags" =~ /^(?=hello)(.*)([^G][^a])(.*)$/ ) ? matches() : print ("Unmatched");
sub matches {
no strict 'refs';
for (1..10) {
my $tmp = ${$_} or next;
print "\$$_ = '$tmp'\n";
}
return 1;
}
__OUTPUT__
$1 = 'hello Ga'
$2 = 'gs'