Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

377 lines (317 sloc) 4.462 kB
#!/usr/bin/perl
# Copyright 2002-2012, Paul Johnson (paul@pjcj.net)
# This software is free. It is licensed under the same terms as Perl itself.
# The latest version of this software should be available from my homepage:
# http://www.pjcj.net
use strict;
use warnings;
my @x;
for my $y (0, 0)
{
for my $z (1, 0)
{
if ($y && $z)
{
$x[1]++;
}
else
{
$x[2]++;
}
if ($y || $z)
{
$x[3]++;
}
else
{
$x[4]++;
}
$y && $x[5]++;
$x[5]++ if $y;
$z && $x[6]++;
$x[6]++ if $z;
$y || $x[7]++;
$x[7]++ unless $y;
$z || $x[8]++;
$x[8]++ unless $z;
$y ? $x[9]++ : $x[10]++;
$z ? $x[11]++ : $x[12]++;
if ($y)
{
$x[13]++;
}
elsif ($y && $z)
{
$x[14]++;
}
elsif ($y || $z)
{
$x[15]++;
}
else
{
$x[16]++;
}
$y && $z && $x[17]++; $y && $z && $x[18]++;
}
}
for my $y (0, 1)
{
$y || next;
$x[18]++;
}
for my $y (1, 0)
{
$y || next;
$x[19]++;
}
for my $y (0, 1)
{
$y && next;
$x[20]++;
}
for my $y (1, 0)
{
$y && next;
$x[21]++;
}
for my $y (0, 1)
{
no warnings "void";
my $w = $y xor next;
$x[22]++;
}
for my $y (1, 0)
{
no warnings "void";
my $w = $y xor next;
$x[23]++;
}
for my $y (0, 1)
{
$y || last;
$x[24]++;
}
for my $y (1, 0)
{
$y || last;
$x[25]++;
}
for my $y (0, 1)
{
$y && last;
$x[26]++;
}
for my $y (1, 0)
{
$y && last;
$x[27]++;
}
for my $y (0, 1)
{
no warnings "void";
my $w = $y xor last;
$x[28]++;
}
for my $y (1, 0)
{
no warnings "void";
my $w = $y xor last;
$x[29]++;
}
for my $y (0, 1)
{
$y || goto G1;
$x[30]++;
}
G1:
for my $y (1, 0)
{
$y || goto G2;
$x[31]++;
}
G2:
for my $y (0, 1)
{
$y && goto G3;
$x[32]++;
}
G3:
for my $y (1, 0)
{
$y && goto G4;
$x[33]++;
}
G4:
for my $y (0, 1)
{
no warnings "void";
my $w = $y xor goto G5;
$x[34]++;
}
G5:
for my $y (1, 0)
{
no warnings "void";
my $w = $y xor goto G6;
$x[35]++;
}
G6:
my $z;
$z = -1;
for my $y (0, 1)
{
$z++;
last if $z > 1;
$z || redo;
$x[36]++;
}
$z = -1;
for my $y (1, 0)
{
$z++;
last if $z > 1;
!$z || redo;
$x[37]++;
}
$z = -1;
for my $y (0, 1)
{
$z++;
last if $z > 1;
$z && redo;
$x[38]++;
}
$z = -1;
for my $y (1, 0)
{
$z++;
last if $z > 1;
!$z && redo;
$x[39]++;
}
$z = -1;
for my $y (0, 1)
{
$z++;
last if $z > 1;
no warnings "void";
my $w = $z xor redo;
$x[40]++;
}
$z = -1;
for my $y (1, 0)
{
$z++;
last if $z > 1;
no warnings "void";
my $w = !$z xor redo;
$x[41]++;
}
my @s =
(
sub
{
shift || return;
$x[42]++;
},
sub
{
shift && return;
$x[43]++;
},
sub
{
no warnings "void";
shift xor return;
$x[44]++;
},
sub
{
my $x = shift || return;
$x[45]++;
},
sub
{
my $x = shift && return;
$x[46]++;
},
sub
{
my $x = shift;
for my $y (1 .. 2)
{
my $z = $x || last;
$x[47]++;
}
},
sub
{
my $x = shift;
for my $y (1 .. 2)
{
my $z = $x || next;
$x[48]++;
}
},
sub
{
my $x = shift;
for my $y (1 .. 2)
{
my $z = $x++ || redo;
$x[49]++;
}
},
sub
{
my $x = shift;
for my $y (1 .. 2)
{
my $z = $x || goto GR;
$x[50]++;
}
GR:
},
sub
{
my $x = shift;
for my $y (1 .. 2)
{
eval { my $z = $x || die };
$x[51]++;
}
},
);
for my $s (@s)
{
for my $y (0, 1)
{
$s->($y)
}
for my $y (1, 0)
{
$s->($y)
}
}
my ($a, $b) = (0, 1);
if ($a && $b)
{
print "path 1\n";
}
elsif (!$a && !$b)
{
print "path 2\n";
}
elsif ($b || 0)
{
print "path 3\n";
if (!$b || $a)
{
print "path 4\n";
}
elsif (!$a && $b)
{
print "path 5\n";
}
}
Jump to Line
Something went wrong with that request. Please try again.