And you can inline the if/else using the ? : operators.
print $_ % 2 ? "$_ is odd\n" : "$_ is even\n" for (1..5)Results:
1 is odd
2 is even
3 is odd
4 is even
5 is odd
how u gonna write your source code if u have to print odd and even number for less than 50 only using while statement for odd and for statement for even number:
Wondering.