Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Calling a function from within a HERE doc?

by kwaping (Priest)
on Aug 16, 2005 at 20:33 UTC ( #484244=note: print w/ replies, xml ) Need Help??


in reply to Calling a function from within a HERE doc?

Here's another way, based on your code:

#!/usr/bin/perl use strict; use warnings; ### sub datestamp(){ use POSIX; return strftime("%D %r",localtime); } my $var_day = datestamp(); ### print <<HERE, datestamp(), <<SECOND; Variable interpolation works - Instead of the literal text seen here, this variable's value is printed. >>$var_day<< But how do you do "function" interpolation? The next line prints itself literally, instead of being substituted with the function's return value. Is there some other way of writing this that does what I want? HERE here's some more text... la la la SECOND print "done!";


Comment on Re: Calling a function from within a HERE doc?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://484244]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2015-08-30 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (350 votes), past polls