use strict; use warnings; my $log = parse_regex( q#(\\.|["']|x)# ); print $log; sub parse_regex { my ($regex) = @_; #--- redirect STDERR open my $olderr,">&STDERR"; close STDERR; open STDERR,">",\ my $parselog; # --- compile regex eval q{ use re 'debug'; qr/$regex/; }; # --- restore STDERR close STDERR; open STDERR, ">&", $olderr; # warn "STDERR Restored! =)\n"; return $parselog; } #### /usr/bin/perl -w /home/lanx/B/PL/PM/parsere.pl Compiling REx "(\.|[%"']|x)" Final program: 1: OPEN1 (3) 3: BRANCH (6) 4: EXACT <.> (21) 6: BRANCH (18) 7: ANYOF["'] (21) 18: BRANCH (FAIL) 19: EXACT (21) 21: CLOSE1 (23) 23: END (0) minlen 1 Freeing REx: "(\.|[%"']|x)" Compilation finished at Mon Nov 4 19:10:27