
Chris Charley
User
Nov 30, 2012, 7:32 AM
Views: 1543
|
|
Re: [MB123] Script Advice: Is it doing what I think it is?
|
|
|
My main question is whether or not the count part of the second code "$count = ($line =~ tr/$data/$data/);" is working as I think No, it isn't getting the count. If you read the docs on the transliteration operator, (it is down 1 or 2 pages from this link), you will find this remark: Because the transliteration table is built at compile time, neither the SEARCHLIST nor the REPLACEMENTLIST are subjected to double quote interpolation. That means that if you want to use variables, you must use an eval(): I haven't had time to look over the program to see what you wish to achieve. $data is the first line of the __DATA__ file. Is that what you need in $data? Update: Irregardless of whether the variable contains quotes, variable interpolation does not occur for transliteration, (for the reason stated above).
(This post was edited by Chris Charley on Nov 30, 2012, 12:13 PM)
|