Nandita Mullapudi wrote:
> Hi all,
> am using the following script to parse a long list of files. funnily
> enough, it works fine when i try a couple sample files, but when i'm
> using a long list of files, it comes up with this error:
>
> readline() on closed filehandle FILE at hashing22.pl line 29, <FILE>
> line 13 (#1)
>     (W closed) The filehandle you're reading from got itself closed
> sometime
>     before now.  Check your logic flow.
>
> i dont know what could be causing this- any ideas?

Well, the most likely is that your open failed.

> here's the script:
> #!/usr/bin/perl-w
> # takes a file where the first line specifies query length, puts in
> ahash # the seqid and numbers listed, adds up the numbers, divides by
> qlen # and give len coverage.
>
> use diagnostics;
>
> $out_dir = "post_parsing_len_cov_files";
> mkdir $out_dir, 0777 unless (-e $out_dir);
> $| = 1;
>
> $files= "./listofnames2";
>
> open (FH,"$files") or die "cannot create list :$!";

You're correctly checking the return form this open.

> while (<FH>) {
>
>     push (@list, $_);
> }
>
> foreach  (@list) {
> $filename=$_;
>
>     open (FILE, $filename);

But not his one,

>     open (HASH_OUT, ">$out_dir/$filename.stats");

or this one. The former of these two is the one you should
be interested in right now,

    open (FILE, $filename) or die "Unable to open $filename: $!";

but put a check on both to avoid future problems!

[snip remainder of code and data]

HTH,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to