open (INPUTFILE, "mysubdir/myinputfile.txt") || die; while (defined ($line = )) { #print $line; chomp $line; $_ = $line; if (m/heart/) { print "'$line' contains the pattern 'heart'\n"; } } close INPUTFILE; print "\n"; open (INPUTFILE, "mysubdir/myinputfile.txt") || die; while (defined ($line = )) { #print $line; chomp $line; $_ = $line; #. single Metacharacter, any single character if (m/he..t/) { print "'$line' contains the pattern 'he**t'\n"; } } close INPUTFILE;