#!/usr/bin/perl -w use strict; my $target=shift; X: for my $x (1 .. 20) { for my $y (1..20) { my $z = $target - $x - $y; next X if $z<1 || $z>20; print "($x,$y,$z)$/"; } }