Dumb-ass answer:

print "Number to square: ";
$num = <STDIN>;

print $num ^ 2, "\n";

I haven't tested this, but you get the idea.

Chris

At 09:55 AM 4/5/2002 -0500, David Mintz wrote:

>I'm sure this question deserves sneers and chortles, but I can't find an
>answer in the Perl docs.
>
>What's the Perl equivalent of the Java(script) method Math.pow(number,
>exponent)?
>
>I know you can say 'print 10e2' and you'll get 1000, but suppose you want
>to prompt the user for the number and print back the number squared or
>something?
>
>Thanks
>
>
>
>David Mintz
>Spanish Interpreter
>US District Court, Southern District of New York
>Web Design & Hosting http://www.dmintzweb.com/
>Personal http://www.panix.com/~dmintz/
>
>"You want me to pour the beer, Frank?"
>
>
>_______________________________________________
>ActivePerl mailing list
>[EMAIL PROTECTED]
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to