#!/usr/bin/perl -w use strict; #statics my $file = 'outodds.txt'; my $width = 80; my $title = "Texas Holdem Odds From Outs"; my $rowdesk = "Outs\tTurn\t\tRiver\t\tEither\n"; #length calcs my $div = '-' x $width . "\n"; my $widthdif = int($width / 2) - int(length($title)/2); #make top section of report my $top = ' ' x $widthdif . $title . "\n"; $top .= ' ' x $widthdif . '-' x length($title) . "\n\n"; $top .= $rowdesk . $div; #make body my @body; for (1 .. 46) { my $row = "$_\t"; #turn my $perc = $_ / 47; $row .= round($perc * 100, 1) . "%\t\t"; #river $perc = $_ / 46; $row .= round($perc * 100, 1) . "%\t\t"; #either $perc = 1 - (47 - $_) * (46 - $_) / (47 * 46); $row .= round($perc * 100, 1) . "%\n"; push @body, $row; } #print output to file open FILE, ">$file" or die; print FILE $top; print FILE @body; close FILE; sub round { #from perlmonks: http://www.perlmonks.org/index.pl?node_id=8786 #I editted to right-justify for percentages rounded one place sprintf "%5.$_[1]f", $_[0]; }