|Perl: the Markov chain saw|
I think I'm starting to get itby coolmichael (Deacon)
|on Apr 04, 2001 at 10:16 UTC||Need Help??|
perl that is. I've been pondering &DBI::connect() and why you have to give it strings like C:\\\\WINDOWS\\\\Desktop.
I got the first bit, that perl was interpolating the slashes when my first feeble attempt didn't work. So, &DBI::connect() really sees it as C:\\WINDOWS\\Desktop and then the function interpolates it again somewhere to get C:\WINDOWS\Desktop
That part is fairly simple, but I was happy to have figured that out on my own.
What was difficult for me to grasp was why perl interpolates the string a second time. I was still thinking in C. "Shouldn't perl just know that it's been interpolated once and not do it again? Wouldn't that be simpler?" I couldn't for the life of me figure it out. I knew there had to be a reason St. Larry did what he did. Like a flash, it just came to me last night while I was trying to sleep (avoid insomnia like the plague). If perl only interpolated strings once, you couldn't do stuff like
which is infinitly useful. And it's probably in the camel I've been reading. Perhaps it's time to RTFM again.
Update: No, I'm not. In fact, I'm rather wrong. No wonder it took so long to figure it out. And it's probably not in the camel either. Damn, I hate when that happens.