[svn:perlfaq] r7929 - perlfaq/trunk
[email protected] Tue, 10 Oct 2006 12:28:42 -0700 (PDT)
| Newsgroups | perl.cvs.perlfaq |
|---|---|
| Message-ID | <[email protected]> |
Author: comdog
Date: Tue Oct 10 12:28:40 2006
New Revision: 7929
Modified:
perlfaq/trunk/perlfaq4.pod
Log:
Clarify context issue with 4.22: How do I expand function calls in a string?
Modified: perlfaq/trunk/perlfaq4.pod
==============================================================================
--- perlfaq/trunk/perlfaq4.pod (original)
+++ perlfaq/trunk/perlfaq4.pod Tue Oct 10 12:28:40 2006
@@ -600,7 +600,9 @@
If we want to call the function in scalar context, we have to do a bit
more work. We can really have any code we like inside the braces, so
we simply have to end with the scalar reference, although how you do
-that is up to you, and you can use code inside the braces.
+that is up to you, and you can use code inside the braces. Note that
+the use of parens creates a list context, so we need C<scalar> to
+force the scalar context on the function:
print "The time is ${\(scalar localtime)}.\n"