#! perl use strict; use warnings; 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 $chwhs = <$fh>; print $chwhs; my @chwhs = split /\s+/, $chwhs; print "Enter Cog Teeth: "; my $cogs = <$fh>; print $cogs; my @cogs = split /\s+/, $cogs; my @gears; for (0 .. 8) { $gears[$_ + 1] = $wheel * $chwhs[0] / $cogs[$_]; $gears[$_ + 10] = $wheel * $chwhs[1] / $cogs[$_]; $gears[$_ + 19] = $wheel * $chwhs[2] / $cogs[$_]; } print "\nYour gears are:\n\n"; print 'Wheelsize: ', $wheel, "\n"; print 'Chainwheels: ', join(' ', @chwhs), "\n"; print 'Sprockets: ', join(' ', @cogs), "\n\n"; for (1 .. 27) { printf "%6.2f ", $gears[$_]; print "\n\n" if $_ % 9 == 0; } __DATA__ 26.5 42 32 22 11 13 15 17 19 21 24 28 32