in reply to Find the biggest number from three numbers

Using prints (as, for example print $a, $b, $c, $big, $equal;) just before line 20 would help you debug this.

And, free, at no extra charge (shipping and delivery, $19.97 or three easy payments of just $99.99 per month for four months), a couple hints:

  1. Since you want to deal with numbers, use == rather than eq to test equality.
  2. Format your code for readability -- chiefly by using indentation ... for example,
    if($first == $second) { # Indentation for readabili +ty $big = $first; $equal = $first; } elsif($first > $second) { # but cuddled elses are mer +ely my preference $big=$first; } else { $big = $second; }
  3. Don't routinely use $a and $b as variables; they're special to sort. While they do no harm here, they would if you attacked this task by using sort.

Replies are listed 'Best First'.
Re^2: Find the biggest number from three numbers
by shrsv (Novice) on Dec 22, 2010 at 15:31 UTC
    Oh ok. And I did put wrong codes in previous posts which I've sorted out myself. And I will be taking your suggestions while writing perl again. I would certainly format my code well. And will make sure to use better variables :) Thank you.