> How to write a device funciton without using a '/' operator
> 
> sub device_now($a, $b){
>   my ($a, $b)=@;
> 
>    <don't use $result=$a/$b; >
> 
>   return $result;
> 
> }
> &device_now(6,3);

That's "divide", not "device".

Not sure it's the solution that the professor had in mind, but you 
can use exponentiation (in Perl written as **,   
5**2=25,5**3=125,...). 

It's enough to remember that 
  x ** -1 = 1 / x

and the rest is trivial.

Another option would be to use a numerical solution. Guess the 
result, see whether it's too big or too small, change the guess 
accordingly, check again and continue like this until the error is 
small enough.

Jenda
===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to