On Friday, December 27, 2002, at 11:00 AM, Paul Kraus wrote:

Ok I am working through the programming Perl book and I don't understand
what you would use this for?

top of pg64
----
$chunk_of_code = q {
if ($condition) {
print "Gotcha!";
}
};


is $chunk_of_code supposed to contain Perl code? If so why? When would
you use this? What does this assign to the variable? I am assuming a
true false value but I am not sure.
I don't have my book handy and I don't remember ever using this, but if you add:

print $chunk_of_code;

to that little program, it prints:

if ($condition) {
print "Gotcha!";
}

So it would seem to be a useful way of putting code into a variable to be printed later without having to escape all the special characters. It may have other uses. I'm going to remember this one, it may come in handy! ^_^

Best,

GmG


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to