#!/usr/athena/bin/perl

open(PL, "/tmp/current-magic");

while(<PL>){
	@v = split(",", $_);
	$cn = $v[0];
	$cp = $v[1];
	$cn =~ s/\s//g;
	$cp =~ s/\s//g;
	$price{$cn} = $cp;
}

while(<>){
	chop;
	s/\(.*//g;
	s/CoP/Circle of Protection/g;
	if($price{$_}){
		$total += $price{$_};
		$ct++;
		print $price{$_}, "\n";
	}
	else{
		print "No match for $_!!!!!!!!!!!!\n";
		$ct++;
	}
}

print "Average price per card:", $total/$ct, "\n"
