#!/usr/bin/perl use strict; use warnings; my $fh = \*STDIN; # For test input, change to: \*DATA ###my $fh = \*DATA; # For user input, change to: \*STDIN print "\nMulti Gear Calculator\n\n"; print "Enter Wheelsize (inches): "; my $wheel = <$fh>; print $wheel; chomp $wheel; print "Enter Chainwheel Teeth: "; my $chainWheels = <$fh>; print $chainWheels; my @chainWheels = split /\s+/, $chainWheels; print "Enter Cog Teeth: "; my $cogs = <$fh>; print $cogs; my @cogs = split /\s+/, $cogs; print "Wheelsize: $wheel\n"; print "Chainwheels: @chainWheels\n"; print "Cogs: @cogs\n\n"; for my $chainSel (1 .. @chainWheels) { my $wheelMul = $wheel * $chainWheels[$chainSel - 1]; print "Chain wheel: $chainSel ratios: \n"; for my $cogSel (1 .. @cogs) { printf "%5.2f ", $wheelMul / $cogs[$cogSel - 1]; } print "\n"; } __DATA__ 26.5 42 32 22 11 13 15 17 19 21 24 28 32