in reply to Re^4: Perl script to match a regexp in the prior line and other multiple lines
in thread Perl script to match a regexp in the prior line and other multiple lines

The  /r modifier was added to  tr/// s/// operators in Perl version 5.14: see Quote Like Operators for  tr/// and Regexp Quote Like Operators for  s/// both in perlop.

Try the following untested changes:
    my $mask = $3 =~ tr//\0/cr . "\xff";
to
    (my $mask = $3) =~ tr//\0/c;
    $mask .= "\xff";
and
    my $column = join '', map +($_ & $mask) =~ tr/\0//dr, split /^/, $pre;
to
    my $column = join '', map { (my $r = $_ & $mask) =~ tr/\0//d;  $r; } split /^/, $pre;

(And yes, heed the advice of afoken here; tybalt89 is the Genie of the Regex, and centuries of folk wisdom tell us that deals done with such a being seldom end well. :)


Give a man a fish:  <%-{-{-{-<