#!/usr/bin/env perl use strict; use warnings; my @tests = ('0', '1', '000', '101', '010', '1 * 0 = 0'); my $format = '%9s | ' x 4 . "\n"; printf $format => qw{initial boundary start/end assign}; for (@tests) { my ($init, $bound, $start, $assign) = ($_) x 4; $bound =~ s/\b0\b/1/; $start =~ s/^0$/1/; $assign = 1 if $assign == 0; printf $format => $init, $bound, $start, $assign; } #### initial | boundary | start/end | assign | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 000 | 000 | 000 | 1 | 101 | 101 | 101 | 101 | 010 | 010 | 010 | 010 | Argument "1 * 0 = 0" isn't numeric in numeric eq (==) at ./pm_example.pl line 16. 1 * 0 = 0 | 1 * 1 = 0 | 1 * 0 = 0 | 1 * 0 = 0 |