I like Randal's answer even if it is technically wrong as you need $1023 to make it work! Some really interesting syntax there. Naturally you want a geometric progression. This is short, but very un-obfu ;-) tachyon print "Enter an integer 1-1000 :"; my $amount = <>; #die "Integers 1-1000 only!\n" unless $amount =~ m/^\d{1,4}$/ and $amount <= 1000 and $amount > 0; my @envelope = qw(1 2 4 8 16 32 64 128 256 490); for (reverse @envelope) { next if $_ > $amount; printf "Giving you envelope with \$%d.00\n", $_; $amount -= $_; }