Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I need to make this equation into a negative number
$math = $high * 50;
And I've tried
$math = $high * 50 * -1;
And
$math = ($high * 50) * -1;
But it errors out. Can someone help me out here?

Replies are listed 'Best First'.
Re: math problem (converting to negative number)
by cLive ;-) (Prior) on Jul 27, 2003 at 06:33 UTC
    If $high can be negative, you'll probably want to use abs:
    $math = -abs($high * 50);

    .02

    cLive ;-)

Re: math problem (converting to negative number)
by BUU (Prior) on Jul 27, 2003 at 04:19 UTC
     $math = -($high * 50)
Re: math problem (converting to negative number)
by fglock (Vicar) on Jul 27, 2003 at 04:33 UTC

    What are the contents of $high?

Re: math problem (converting to negative number)
by Anonymous Monk on Jul 28, 2003 at 06:39 UTC
    Um. Both those expressions work for me (perl v5.8.0). What error do you get?