in reply to Executing external program via backquotes
You probably want something like this (UNTESTED):
#!/usr/bin/perl use warnings; use strict; unless ( @ARGV == 2 ) { die "Need both new candidate list and candidate list archive!\n"; } my ( $can_list, $can_archive ) = @ARGV; # Open candidate list open LIST, '<', $can_list or die "Cannot open new candidate list file! + $!"; chomp( my @new_candidates = <LIST> ); # Open results log open LOG, '>', '/data/My Documents/candidates_results.log' or die "Cou +ld not open candidate search log: $!"; open LIST, '<', $can_archive or die "Cannot open '$can_archive' $!"; while ( my $line = <LIST> ) { foreach my $result ( @new_candidates ) { print LOG $line if $line =~ /$result/i; } } close LOG; close LIST;
|
|---|