in reply to readline on closed filehandle error
I condensed your script down to the offending part. It still needs some work, but the readline warning disappeared.
#!/usr/bin/perl use strict; no strict 'refs'; use warnings; my $in16S = '/root/Desktop/pro.faa'; open I16S, '<', $in16S; my %r_genus16S; my ($genus16s) = <I16S>; while ( defined( ${'genus16S'} = readline(*I16S) ) ) { if ( $_ =~ />(\w+)\s/ ) { ${'genus16S'} = $1; } if ( exists $${'genus16S'}{ ${'genus16S'} } ) { print { 'I16S'; } $_; $${'genus16S'}{ ${'genus16S'} } = 'p'; next; } } my $no16S = 0; foreach $_ ( keys %${ 'r_genus16S'; } ) { if ( $${'genus16S'}{$_} eq 'n' ) { ++$no16S; print "$_\n"; next; } } close I16S;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: readline on closed filehandle error
by jwkrahn (Abbot) on Jan 24, 2012 at 07:23 UTC |