in reply to root function

It's just basic maths. The cube root of 27 is 27**(1/3). If you really want a function, try
print wop( 8, 3 ); #2 print wop( 27, 3 ); #3 sub wop { my ( $base, $root ) = @_; return $base ** (1/$root) }

update: s/If/If you/


Unless I state otherwise, all my code runs with strict and warnings

Replies are listed 'Best First'.
Re^2: root function
by hobbs (Monk) on Jun 24, 2008 at 00:53 UTC
    You're going to have to rename that function "whop" for a US audience. :)