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; }
In reply to Remove from List by PyrexKidd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |