in reply to Re: eval
in thread evaluating fractions

They are fractions (i.e 1/4 etc) and I do want to evaluate them for there decimal values (i.e 0.25).
How do I use the eval function to do this ?
and store each decimal number in a variable of type FRAC [$i][$j]

Replies are listed 'Best First'.
Re: Re: Re: eval
by tachyon (Chancellor) on Dec 20, 2001 at 22:32 UTC
    $frac = '1/4'; $dec = eval $frac; print "$frac = $dec";

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: Re: Re: eval
by AidanLee (Chaplain) on Dec 20, 2001 at 22:00 UTC
    You could always look up the eval function to find out.
Re: Re: Re: eval
by tradez (Pilgrim) on Dec 21, 2001 at 01:07 UTC
    why do you need them to be in that format, and what exactly do you mean by it? If all you are looking for is the decimal equiv, just use perl
    $eval = (1/4); print $eval; 0.25
    I may be off the mark, but I hate the way sometimes people try to make this completely obscure code on here when sometimes simple is clearly better. If using eval has a better purpose for THIS PARTICULAR ISSUE, i would love to hear it.