Hi,
I've just written my first practice script from a book on learning perl.
it just performs a basic calculation of the area of a circle. out of
interest I decided I wanted the answer underlined and that the underline
should be the exact length of the answer. the script is shown below. The
problem is that $answer returns a value of 1 and not the contents of the
printf. I guess I've assigned it incorrectly. the other odd thing is that
the -- print "$answer" -- line appears not t be neccesary as the
preceding line prints to the screen anyway.
Any thoughts,
Thanks very any help,
Adrian
#!/usr/bin/perl
while (true)
{
print "\nEnter radius: ";
chomp($radius = <STDIN>);
$pi = 3.1415926535897932384626433832795;
$area = $pi*($radius**2);
$answer = printf ("\nThe area of the circle with a radius of $radius is
%2.2f\n", ($area));
print "$answer"
$len = length $answer;
$line = "-" x $len;
print "$line\n\n\n";
}
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]