#!/usr/bin/perl #! HOW PERL REGULAR EXPRESSIONS WORK #! Poem is "Neither Out Far Nor Deep In" by Robert Frost #! Format = $[VARIABLE TO BE EXAMINED] =~ /[REGEX]/: #! Simple pattern: $L1 = "The people along the sand"; if ($L1 =~/people/){ print $L1; } print "\n"; #! You don't need to assign a variable, if you can examine last variable: $L2 = "All turn and look one way"; $_ = $L2; if (/turn/){ print $_; } print "\n"; #! The Dot ("."), to represent a single character: $L3 = "They turn their back on the land"; $L4 = "They look at the sea all day"; if ($L3 =~/b.ck/){ print $L3; } print "\n"; if ($L4 =~/l..k/){ print $L4; } print "\n";