However it would fail for a list containing an element with value zero since in that case the shift operation returns a false result.
This should fix it:
sub isAscending2{ $_[0] < $_[1] and (shift() or 1) or return 0 while @_>1; return 1; }
In reply to Re^2: Checking the Ascendency/Descendency of Numeric Array of Any Size
by varian
in thread Checking the Ascendency/Descendency of Numeric Array of Any Size
by monkfan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |