use re 'debug'; for (1..2) { $re_str = $_; print("***** $_ *****\n"); /$re_str/; } $re_str = "\\d"; for (3..4) { print("***** $_ *****\n"); /$re_str/; } #### ***** 1 ***** Compiling REx `1' Guessing start of match, REx "1" against "1"... ***** 2 ***** Compiling REx `2' Guessing start of match, REx "2" against "2"... ***** 3 ***** Compiling REx `\d' Matching REx "\d" against "3" ***** 4 ***** Matching REx "\d" against "4" <--- No "Compiling" before this.