##
use strict;
use warnings;
my $string = "Hello world!";
$string =~ m/(H\w+)\s(\w+)/; # This match succeeds.
print $2, "\n";
$string =~ /(\d)(\d)/; # This match fails.
print $2, "\n";
##
##
world
world
##
##
my $tmp2 = $var; # Because of bad logic we don't know
# if $var is defined, thus don't know if
# $tmp2 is defined.
if ( defined( $tmp2 ) and $tmp2 =~ m/regex/ ) {
# Do your stuff.
}