Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#!C:/perl/bin/perl.exe
open FILE, "c:/perl/notice.txt" || die "failed to open notice.txt $!\n";
@read=<FILE>; # read entire file into array
close FILE;
chomp @read;
print "search a word\?\n";
$choose=<STDIN>; chomp $choose;
if($choose =~ /yes|ok/) {
print "enter a word\n";
$choose=<STDIN>; chomp $choose;
foreach(grep(/$choose/,@read)) {
print "result: $_\n";
}
}
A file handle is not a variable, so I have replaced $read with FILE where appropriate.
open( my $file, "foo");
while(<$file>){
....
}