CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [MB123] Script Advice: Is it doing what I think it is?: Edit Log



Chris Charley
User

Nov 30, 2012, 7:32 AM


Views: 2794
Re: [MB123] Script Advice: Is it doing what I think it is?


Quote
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:


Quote
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)


Edit Log:
Post edited by Chris Charley (User) on Nov 30, 2012, 7:36 AM
Post edited by Chris Charley (User) on Nov 30, 2012, 12:13 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives