#!/usr/bin/perl -w


sub sqroot
{

	local($num,$l,$h) = @_;
	local($m,$diff);
	#local($num, $l, $m, $h,$diff);
	#$num = shift;
	#$l = shift;
	#$h = shift;
	$m = ($h + $l)/2;
	$diff = $m**2-$num;
	print "L = $l M = $m H = $h Diff = $diff\n";
	return $m if (abs($diff) < 0.000001);
	return sqroot($num, $l, $m) if ($diff > 0);
	return sqroot($num, $m, $h);
}

print "Enter a number :";
$num = <STDIN>;
print sqroot($num,0,$num+1);
