in reply to Re: Strange saving behaviour
in thread Strange saving behaviour

Hi!

I should keep my mouth shut, but wouldn't that return 'true'
for every number above 1 ?..

I believe 'int' returns the integer part...

is_int(6.66) would return 6... and not check if it's an int

Sorry if I'm totally on the wrong track here...

GreetZ!,

print "profeth still\n" if /bird|devil/;

Replies are listed 'Best First'.
Re: Re: Re: Strange saving behaviour
by arturo (Vicar) on Feb 01, 2001 at 19:42 UTC

    I think you may have misread it: that's an equality test in the last line, not an assignment =)

    It returns the value of the last statement in the sub, i.e, the value of

    $num == int($num);

    Which is true (== 1) if $num and the integer part of $num are equal to each other, and false (==0)otherwise.

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor

      *duck*...

      Totally right.. I missed the 2nd '=' there... SO sorry...

      GreetZ!,
        ChOas

      print "profeth still\n" if /bird|devil/;
Re: Re: Re: Strange saving behaviour
by davorg (Chancellor) on Feb 01, 2001 at 19:45 UTC

    Umm... no. It works as advertised.

    is_int(6.66) returns the result of 6.66 == int(6.66) which is the same as 6.66 == 6 which is false.

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me