|The stupid question is the question not asked|
using a string as a SCALAR ref while "strict refs" in useby xorl (Deacon)
|on Jun 19, 2012 at 11:10 UTC||Need Help??|
xorl has asked for the
wisdom of the Perl Monks concerning the following question:
I have a list of variable names that I want to loop through and do stuff to the actual variable.
Of course I get the error "Can't use string ("newfoo") as a SCALAR ref while "strict refs" in use"
Searching I found can't use string as a SCALAR ref while strict refs which says to use a hard reference. However I have no clue how to do that in the foreach loop.
Further down in that node (and in other search results) suggest using a hash. I really don't see how to do that in my case.
What I'm trying to do is write a script that will update values in one of our app's config file. I just don't want to have to type a million lines of code to test each value to see if it should be updated or not. The above is what I came up with. If I can make that work, great. If there's a better way, let me know that too.
Thanks in advance