in reply to Re^2: Whats wrong in this code?
in thread Whats wrong in this code?

Hello abhikalrt53,

You need to close the filehandle before you can unlink the file:

... open my $fh, '<', $file or die "Cannot open file $file: $!"; my $headers = grep /^>/, <$fh>; close $fh or die "Cannot close file $file: $!"; if ($headers <= 3) { unlink ...

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,