Regular Expressions
Literal Match
A regex can look for a fixed piece of text inside a scalar.
Literal Match
literal_match.pl
use strict;
use warnings;
my $text = ;
my $has_regex = $text =~ /regex/;
my $result = $has_regex ? "found" : "missing";
print "text=$text\n";
print "result=$result\n";
use strict;
use warnings;
my $text = ;
my $has_regex = $text =~ /regex/;
my $result = $has_regex ? "found" : "missing";
print "text=$text\n";
print "result=$result\n";
use strict;
use warnings;
my $text = ;
my $has_regex = $text =~ /regex/;
my $result = $has_regex ? "found" : "missing";
print "text=$text\n";
print "result=$result\n";
literal match
A literal match searches for the exact characters written in the pattern.