use strict;
use warnings;
use IPC::Run3;
use Regexp::Compare qw( is_less_or_equal );
my @re = (
qr/asdf/,
qr/asd/,
qr/as/,
qr/a/,
qr/./,
qr/.*/,
);
my $stdin = '';
my $stdout = '';
my $stderr = '';
for my $i ( 0 .. $#re ) {
for my $j ( 0 .. $#re ) {
$stdin .= "$i $j\n" if is_less_or_equal( $re[$i], $re[$j] );
}
}
# tsort (GNU coreutils) 8.4
run3 [ 'tsort' ], \$stdin, \$stdout, \$stderr;
print $stderr;
my @idx = split /\s+/, $stdout;
print "$_\n" for @re[@idx];
####
my @re = (
qw/./,
qw/./,
qw/.+/,
);
####
in $stderr:
tsort: -: input contains a loop:
tsort: 0
tsort: 2
tsort: 1
tsort: -: input contains a loop:
tsort: 0
tsort: 2
tsort: -: input contains a loop:
tsort: 1
tsort: 2
####
hypothesis:
$re1 <= $re2
is_less_or_equal( $re1, $re2 )
specific -> $re1 $re2 <- generic
if exists $str that
$str =~ /$re1/ and $str =~ /$re2/ -> no consequence
$str =~ /$re1/ and $str !~ /$re2/ -> falsifies hypothesis
$str !~ /$re1/ and $str =~ /$re2/ -> corroborates hypothesis
$str !~ /$re1/ and $str !~ /$re2/ -> no consequence