$infile=$ARGV[0];
# $Id: lineinterpol.pl,v 1.1 2006/03/29 07:36:57 skoch Exp $
open(INFILE,$infile);
$ival=$ARGV[1];
$last=0;
while (<INFILE>) { 
$lineno++;
@line=split(' ',$_);
$yval=$line[1];
$cval=$line[0];
if (($lineno>1)&&(($ival-$last)*($ival-$cval)<0)){ 
$deltax=$cval-$last;
$diffx=$ival-$last;
$deltay=$yval-$ylast;
$ipv=$deltay/$deltax*$diffx+$ylast;
print $ival," ",$ipv,"\n";
exit;
}
$last= $cval;
$ylast=$yval;
}
print $ival," ",-32768,"\n";
;
