Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Only strings can be hash keys. So when building %dict with regular expressions (the qr// constructs), they are converted to strings to become keys in the hash1. For regular expressions, incidentally, these are strings that can be compiled back into the same regular expression they stemmed from - which is quite convenient. So why did this not do anything to bichonfrisee74's input strings? I was scratching my head myself until I use'd re 'debug'. zwon happened to forget to escape the parentheses in his (intermediary) example. So if you use the (correctly written) qr// constructs below, things "work" as expected:
1The ?-xism used to confuse me until I realized this just explicitly states: turn off the x, i, s and m regex flags. In reply to Re^3: Hash of Regex
by crashtest
|
|