http://qs1969.pair.com?node_id=157866

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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: how do i test a number negative or positive?
by Kanji (Parson) on Apr 09, 2002 at 22:25 UTC
Re: how do i test a number negative or positive?
by PodMaster (Abbot) on Apr 10, 2002 at 03:19 UTC
    check out perlsyn and perlop (in particular the comparison operators)
    my $num = $_ = 4; if($num >= 0) { die "$num is positive"; } else { die "$num is negative (but we already knew that)"; } # or even ;) my $num = $_ = -4; if(substr($num,0,1,) eq '-') { die "I, $num, feel so negative today"; } else { die "$num says 'Things are looking up'"; }
Re: how do i test a number negative or positive?
by dswimboy (Initiate) on Apr 09, 2002 at 21:43 UTC
    wow...i'm sorry. how do you test if a number is even or odd...i'm sorry

    Originally posted as a Categorized Answer.