in reply to Re: How can I change the perl program involving if-elsif-else conditional to get correct result?
in thread How can I change the perl program involving if-elsif-else conditional to get correct result?

Or instead of reinventing the wheel, you could sort a list:

my @list = sort ($a, $b, $c); print $list[$#list];

I'm too lazy to be proud of being impatient.
  • Comment on Re^2: How can I change the perl program involving if-elsif-else conditional to get correct result?
  • Download Code

Replies are listed 'Best First'.
Re^3: How can I change the perl program involving if-elsif-else conditional to get correct result?
by Marshall (Canon) on Apr 23, 2012 at 12:48 UTC
    If you are going to do it like that, you need a numeric sort, not the default alphabetic sort:
    @sorted = sort{$a <=> $b}($x, $y, $z); print $sorted[-1];
    Also, $a and $b are special variables reserved for sort and other purposes. Don't uses these for normal user variables.