- or download this
my $string = "abcdefDaveghijkl";
if ( $string =~ /Dave/ ) {
print "I found Dave.\n";
}
- or download this
my $string = "1.23.45";
print "Found a number.\n" if /\d+/;
- or download this
my $string = "1.234.567.txt";
print "Found a good filename.\n" if /\d+\.txt/;
- or download this
my $string = "1.234.567.txt";
print "Match.\n" if /567.txt/;
- or download this
/^\d+\.txt/
- or download this
my $testname = " 456.txt";
my $filename;
if ($filename = $testname=~ /^\s*?(\d+\.txt)\s*?$/ ) {
print "Found a file named $filename.\n";
}