#!/tools/packarch/public/perl/5.8.8/bin/perl use strict; use warnings; open(my $file, "<", "input.txt") or die "Can't open input.txt: $!"; my $string = "icecream"; while (<$file>) { if (/$string/) { print "found string $string\n"; } else { print "did not find the string\n"; } }