What am I doing wrong?
That's just 4 possibilities and you won't know which is the real problem until you add some diagnostics to your script. eg (untested):
use strict; use warnings; while ( my $file = glob '*.txt' ) { print "Debug: found file $file\n"; open my $fh, '<', $file or die "Cannot open file $file: $!"; my $headers = grep /^>/, <$fh>; if ($headers <= 3) { unlink $file or die "Cannot unlink file $file: $!"; } else { print "Debug: file $file only has $headers headers - skipping\ +n"; } }
In reply to Re: Whats wrong in this code?
by hippo
in thread Whats wrong in this code?
by abhikalrt53
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |