Irfan J Sayed schreef: > I am using following code > > #!/usr/local/bin/perl > > # Main program > > use warnings; > use strict; > use File::Find; > > my $file = 'c:\\backup.pl'; > open (FH, $file); > my ($line); > my $word = pop; > while ($line = <FH>) > { > if ($line =~/$word/) > { > print "match found"; > } > else > { > print "match not found"; > } > } > close FH; > > Following is the error > > readline() on closed filehandle FH at C:\irfan\search.pl line 13. > > can anybody plz help
1. see my previous reply: news:[EMAIL PROTECTED] 2. fix the indentation of your script, it's a mess now 3. guard your opens and closes (see 1.) 4. use quotemeta for user input: /\Q$word\E/ (see `perldoc -f quotemeta`) -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>