#!/usr/bin/perl use strict; use warnings; #use diagnostics; if (@ARGV = 2){ my %delList; open my $BEEPON, '>>', "./beepon.file" || die "Can't open beepon.file $!"; open my $BEEPOFF, '>>', "./beepoff.file" || die "Can't open beepoff.file $!"; open my $DELLIST, '<', $ARGV[0] || die "Can't open $ARGV[0] $!"; foreach (<$DELLIST>){ chomp($_); $delList{$_} = 1; } close $DELLIST; open my $ORGLIST, '<' , $ARGV[1] || die "Cant open $ARGV[1] $!"; foreach my $entry (<$ORGLIST>){ chomp($entry); print { exists $delList{$entry} ? $BEEPON : $BEEPOFF } $entry . "\n"; } close $BEEPON; close $BEEPOFF; } #### $./delete_list_ver3.pl test.list test_master.1 readline() on closed filehandle $DELLIST at ./delete_list_ver3.pl line 12. Use of uninitialized value $ARGV[1] in concatenation (.) or string at ./delete_list_ver3.pl line 17. Cant open Bad file descriptor at ./delete_list_ver3.pl line 17.