#! /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[]/; }; ################## ## Main Program ## ################## for (my $i = 0; $i <= 1000; $i++) { try($i); } ################# ## Subroutines ## ################# sub try { my ($n) = @_; my $new = $text; $new =~ s//$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? '.': '@'; } }