if ( ! -s $file ) { die "File $file does not exist! Check the command line or +the pedigree file for errors!\ +n"; }
Either your error message is wrong or you are using the wrong file test operator. File existence is tested with the -e operator. You are testing that the file exists and has zero size.
if ( $file =~ /.*\.bz2/ ) { ... } elsif ( $file =~ /.*\.gz/ ) {
you are not testing that the last characters in the file name are either '.bz2' or '.gz' (the file extention), you are testing that those strings are anywhere in the file name. You need to anchor the patterns to the end of the file name:
if ( $file =~ /\.bz2\z/ ) { ... } elsif ( $file =~ /\.gz\z/ ) {
In reply to Re: Seeking in a file
by jwkrahn
in thread Seeking in a file
by Ineffectual
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |