in reply to A Gear Inch Calculator for Cyclists
To cater for a user who types 'Y' instead of 'y', it is considered better to normalize the user input to the same case as your test (unless you want the program to react differently between 'Y' and 'y'):
print "Is your rear wheel metric? (y/n): "; chomp ($_ = <STDIN>); if (lc($_) eq "y")
As lc by default works on $_, you could use lc instead of lc($_), but that is perhaps unnecessarily obfuscated (Are there necessary obfuscations?)
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
|
|---|