![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
I am trying to analyze someone else's code and understand what it does. One small block in particular is confusing me:
For purposes of testing, $data is set to a "string" of the entire ASCII table (0-255) appended together. I expect that if the first regex (in the if) finds any character that is not in the regex, the expression evaluates to true and it enters the block. If $data consists entirely of those special characters, the expression will evaluate false. Once in the block, the tr///cs is where my confusion lies. In the Camel book, it says that /c causes the SEARCHLIST character set to be complemented. I expect this to mean that the SEARCHLIST will now match any character that is NOT included in the list. However, the output of $data is: This is considerably more than what I expect to see. Can anyone explain this bit of code to me? In reply to tr///c doesn't seem to work as I expect by romandas
|
|