use strict; use warnings; use Set::CrossProduct; my @ops = qw( * + - / ); my $expr = '2006 == ' . join ' %s ', 1 .. 9; my $xp = Set::CrossProduct->new( [ map \@ops, $expr =~ /%s/g ] ); while( my @attempt = $xp->get ) { my $attempt = sprintf $expr, @attempt; print $attempt, "\n" if eval $attempt; }
Makeshifts last the longest.
In reply to Re: Happy 2006
by Aristotle
in thread Happy 2006
by Perl Mouse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |