* deleted an extra "of" * added an example of the Interpolation module
=================================================================== RCS file: /cvs/public/perlfaq/perlfaq4.pod,v retrieving revision 1.71 diff -u -d -r1.71 perlfaq4.pod --- perlfaq4.pod 23 Nov 2005 07:46:45 -0000 1.71 +++ perlfaq4.pod 22 Dec 2005 17:12:30 -0000 @@ -589,7 +589,7 @@ This is documented in L<perlref>, and although it's not the easiest thing to read, it does work. In each of these examples, we call the -function inside the braces of used to dereference a reference. If we +function inside the braces used to dereference a reference. If we have a more than one return value, we can construct and dereference an anonymous array. In this case, we call the function in list context. @@ -610,9 +610,17 @@ sub timestamp { my $t = localtime; \$t } print "The time is ${ timestamp() }.\n"; + +The C<Interpolation> module can also do a lot of magic for you. You can +specify a variable name, in this case C<E>, to set up a tied hash that +does the interpolation for you. It has several other methods to do this +as well. + + use Interpolation E => 'eval'; + print "The time values are $E{localtime()}.\n"; -In most cases, it is probably easier to simply use string -concatenation, which also forces scalar context. +In most cases, it is probably easier to simply use string concatenation, +which also forces scalar context. print "The time is " . localtime . ".\n"; -- brian d foy, [EMAIL PROTECTED]