Irfan J Sayed am Freitag, 2. Juni 2006 09:23: > Hi All, Hi
> I am using following code > > #!/usr/local/bin/perl > > # Main program > > use warnings; > use strict; > use File::Find; # File::Find is never used > > my $file = 'c:\\backup.pl'; > open (FH, $file); # Always check results of system calls: open (FH, $file) or die "error opening '$file' $!"; # ...and adjust the filename. See the error below which gives you a hint. > my ($line); # not necessary, see below > my $word = pop; # takes the last cmdline argument; if only one is passed, # shift is more common # you also want to check the usage: my $word=shift or die "please give a word to search\n"; > while ($line = <FH>) > { > if ($line =~/$word/) > { > print "match found"; > } > else > { > print "match not found"; > } > } # in short: print 'match ', (/\Q$word\E/ ? '' : 'not'), " found for '$word'\n" for <FH>; # note the \Q\E (where \E is not really necessary since at the end of # the regex) that assures that all chars are interpreted literally, # perldoc -f quotemeta > close FH; Always check system call results > Following is the error > > readline() on closed filehandle FH at C:\irfan\search.pl line 13. > > can anybody plz help > > Regards > Irfan Sayed -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>