PyrexKidd has asked for the wisdom of the Perl Monks concerning the following question:
The code below is designed to read a file into a hash, and then parse through a nother file. if the entry is found, the entry should be put in $BEEPON, if the entry is not found it should be put it $BEEPOFF.
the problem I am having is this error:
readline() on closed filehandle $LISTDEL at ./delete_list_ver3.pl line + 12 (#1) (W closed) The filehandle you're reading from got itself closed so +metime before now. Check your control flow.
Any thoughts? as far as I can tell the file is open... What is going on?
Thanks in advance.
#!/usr/bin/perl use strict; use warnings; use diagnostics; if (@ARGV = 2){ my %delList; open my $BEEPON, '>>', "./beepon.file"; open my $BEEPOFF, '>>', "./beepoff.file"; open my $LISTDEL, '<', $ARGV[0]; foreach (<$LISTDEL>){ chomp($_); $delList{$_} = 1; } open (my $ORGLIST, '<', $ARGV[1]); foreach my $entry (<$ORGLIST>){ chomp($entry); print { exists $delList{$entry} ? $BEEPON : $BEEPOFF } $entry +. "\n"; } close $LISTDEL; close $BEEPON; close $BEEPOFF; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Remove from List
by toolic (Bishop) on Aug 23, 2010 at 21:36 UTC | |
by PyrexKidd (Monk) on Aug 23, 2010 at 21:50 UTC | |
by psini (Deacon) on Aug 23, 2010 at 21:55 UTC | |
by chromatic (Archbishop) on Aug 23, 2010 at 22:04 UTC | |
|
Re: Remove from List
by psini (Deacon) on Aug 23, 2010 at 21:32 UTC | |
|
Re: Remove from List
by TomDLux (Vicar) on Aug 24, 2010 at 05:55 UTC |