perlmeditation
coolmichael
perl that is. I've been pondering <font face="Courier">&DBI::connect()</font> and why you have to give
it strings like <font face="Courier">C:\\\\WINDOWS\\\\Desktop.</font>
<p>I got the first bit, that perl was interpolating the slashes when my first
feeble attempt didn't work. So, <font face="Courier">&DBI::connect()</font> really sees it as <font face="Courier">C:\\WINDOWS\\Desktop</font>
and then the function interpolates it again somewhere to get <font face="Courier">C:\WINDOWS\Desktop</font>
<p>That part is fairly simple, but I was happy to have figured that out on my
own.
<p>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
<code>
$foo="can I get you a \$bar?\n";
$bar="cow";
print $foo;
$bar="chicken";
print $foo;
</code>
which is infinitly useful. And it's probably in the camel I've been reading. Perhaps
it's time to RTFM again.
<P><b>Update:</b> 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.
<p><a href="http://www.perlmonks.com/index.pl?node=coolmichael&lastnode_id=1072">michael</a><br>
the blue haired monk</p>