http://www.perlmonks.org?node_id=869349


in reply to Match operator fails for elements 100 and higher

With a nod to Crackers2 above, who pointed out perl -MO=Deparse, here is a sort of "meta" program, which tries 'deparsing' ...
my $check = m/$mystrings[N]/;

... on incrementing values of N:

#! /usr/bin/perl -w ############### ## Libraries ## ############### use strict; use warnings; use File::Basename; use B::Deparse; use IO::File; ############# ## Globals ## ############# my $iam = basename $0; $| = 1; my $b_verbose = 0; my $text = q{ use strict; use warnings; my @mystrings = ( "string" ) x 200; my $check = m/$mystrings[<NUM>]/; }; ################## ## Main Program ## ################## for (my $i = 0; $i <= 1000; $i++) { try($i); } ################# ## Subroutines ## ################# sub try { my ($n) = @_; my $new = $text; $new =~ s/<NUM>/$n/g; my $fn = 'test.pl'; my $fh = new IO::File($fn, "w") or die "Can't write '$fn' ($!)\n"; print $fh "$new\n"; close $fh; chomp(my @results = `perl -MO=Deparse $fn 2>&1`); my ($check) = grep { /check/ } @results; my $b_ok = ($check =~ /my \$check = \$mystrings\[\d+\]/)? 1: 0; if ($b_verbose) { printf "Value %4d => %s\n", $n, $b_ok? "Okay": "*** FAILS ***" +; } else { printf "%s", $b_ok? '.': '@'; } }

It prints '.' or '@' for "Okay" and "Failed" values of N, respectively.

You can also assign $b_verbose to a nonzero value to see more verbose results :)


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/