perl -e "my $var; 'string'=~/[$var]/" #### Unmatched [ in regex; marked by <-- HERE in m/[ <-- HERE ]/ at -e line 1.