Skip to content

Instantly share code, notes, and snippets.

@dbb
Created September 18, 2010 03:12
Show Gist options
  • Save dbb/585294 to your computer and use it in GitHub Desktop.
Save dbb/585294 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
# github.com/dbbolton
#
# simple "truth table" evaluator
for my $i (0..1) {
for my $j (0..1) {
for my $k (0..1) {
for my $l (0..1) {
print "$i$j$k$l";
print " AND" if ( $i && $j && $k && $l);
print " OR" if ( $i || $j || $k || $l);
# et cetera
print "\n";
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment