#!/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
{
my $notfound = "not found";
}
}
if (my $notfound eq "not found")
{
print "string not found\n";
}
I'm seeing this error now:
Use of uninitialized value in string eq at ./testScript.pl line 19, <$file> line 8.
What does this mean? the file input.txt does not contain the string "icecream" so ideally i should see the output at "string not found"
ps. thank you guys for all your help!
|