in reply to Regex delimiter

perl -wle 'for (0 .. 255) { $delim = chr; next if $delim =~ /\w/; eval "m$delim...$delim"; print "Bad: $_ ($delim)" if $@ }' Bad: 9 ( ) # tab Bad: 10 ( # newline ) Bad: 12 ( # formfeed ) )ad: 13 ( # carriage return Bad: 32 ( ) # substitute Bad: 40 (() # OK paired Bad: 46 (.) Bad: 59 (;) Bad: 60 (<) # OK paired Bad: 91 ([) # OK paired Bad: 123 ({) # OK paired Bad: 137 (_) # warns only, but it's wrong

Replies are listed 'Best First'.
Re^2: Regex delimiter
by lidden (Curate) on Jun 26, 2007 at 21:55 UTC
    Changing your code to:
    perl -wle 'for (0 .. 255) { $delim = chr; next if $delim =~ /\w/; eval "m${delim}foo$delim;"; print "Bad: $_ ($delim)" if $@ }'
    Makes '.' and ';' pass too. I also have no problem with '_'.