Perlers,
I'm stumped; I have a script that should output to a file but it
doesn't. The file is created, but it's empty after the script
completes. To be sure I was getting some sort of output, I had the
script write to the terminal and all was well. The odd thing, however,
is that I still can't redirect it into a file! Any clues? My script is
below.
--begin script--
#!/usr/bin/perl
use strict;
use warnings;
my $missing_claims = "missing_claims.txt";
my $ih_file = "ih.new";
my $output = "matches.log";
my @claims;
open(MISSING, $missing_claims) or die "Unable to open
$missing_claims:$!\n";
chomp(@claims = <MISSING>);
close MISSING;
my @ih;
open(IH, $ih_file) or die "Unable to open $ih_file:!\n";
@ih = <IH>;
close IH;
open(LOG, ">>$output") or die "Unable to open $output:!\n";
print LOG "------------ ------ ------- ----------\n";
print LOG " Image Name Loc. Removed New Loc. \n";
print LOG "------------ ------ ------- ----------\n";
foreach my $claim (@claims) {
# print "CLAIM: $claim\n";
my @matched = grep /$claim/, @ih;
if ( @matched ){
print LOG "@matched";
#print "@matched";
}
# my $num_matched = @matched;
# print "Claim matched: $num_matched: @matched\n";
}
close LOG;
--end script--
ry
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>