- 论坛徽章:
- 145
|
本帖最后由 jason680 于 2016-07-20 11:43 编辑
回复 6# smile1129
C:\>perl get_id.pl
Usage : perl get_id.pl FILE_TABLE FILE_ID
Example: perl get_id.pl 1.txt 2.txt
C:\>perl get_id.pl 1.txt 2.txt > 3.txt
C:\>type 3.txt
19870301
19870302
19870305
C:\>type get_id.pl
use strict;
use warnings;
sub message{
print <<EOF;
Usage : perl $0 FILE_TABLE FILE_ID
Example: perl $0 1.txt 2.txt
EOF
print "@_" if @_;
exit 2;
}
message() if (@ARGV !=2);
my($sFtb, $sFid) = @ARGV;
open(FHtb, "<", "$sFtb") or die "cannot open $sFtb\n";
open(FHid, "<", "$sFid") or die "cannot open $sFid\n";
my %hTb;
while(<FHtb>){
chomp;
my($sID, $sVal) = split(":");
$hTb{$sID} = $sVal;
}
while(<FHid>){
chomp;
my $sOut = $hTb{$_} // "";
print "$sOut\n";
}
|
评分
-
查看全部评分
|