#!/usr/bin/perl -w print "Enter the number of teeth on the chainring: "; chomp ($chainring = ); print "Enter the number of teeth on the cog: "; chomp ($cog = ); if ($cog <= 0) { print "Error: The gear inches cannot be calculated using $cog as a cog value. Please enter another value."; } else { print "Is your rear wheel metric? (y/n): "; chomp ($_ = ); if ($_ eq "y") { print "Enter your metric wheel size in millimeters: "; chomp ($metric = ); $wheel = $metric * .039; $gear_inches = ($chainring / $cog) * $wheel; print "The gear inches for a chainring of $chainring teeth and a cog of $cog teeth and a wheel of $metric millimeters is $gear_inches gear inches.\n"; } else { print "Enter your wheel size in inches: "; chomp ($wheel = ); $gear_inches = ($chainring / $cog) * $wheel; print "The gear inches for a chainring of $chainring teeth and a cog of $cog teeth for a wheel $wheel inches in diameter is $gear_inches gear inches.\n"; } }