All pastes #14516 Raw Edit

boch

public text v1 · immutable
#14516 ·published 2005-06-14 16:14 UTC
rendered paste body
#!/usr/bin/perl

#	www-srv(0)# ./lala.pl file1 file2
#	pepe,jesus
#	anto,maria
#	jose,jose
#	maria,anto
#	jesus,pepe
#	www-srv(0)# cat file1
#	1,pepe
#	2,anto
#	3,jose
#	4,maria
#	5,jesus
#	www-srv(0)# cat file2
#	pepe,5
#	anto,4
#	jose,3
#	maria,2
#	jesus,1


sub get {
	open f2, $ARGV[1] or die $!;
	while(<f2>){ return +(split ",", $_)[0] if($_ =~ /,$_[0]$/) };
}
open f1, $ARGV[0] or die $!;
while(<f1>){
	chop $_;
	print +(split ",", $_)[1].",".get(+(split ",", $_)[0])."\n";
}
close f1;