my $x = '5.1.1'; # OOPS if ( $x =~ m/5.1/ ) { print "'$x' is 5.1\n"; } # better if ( $x =~ m/^5.1$/ ) { print "'$x' is 5.1\n"; }