borkabrak has asked for the wisdom of the Perl Monks concerning the following question:
I hope the example is sufficiently clear. I must admit that I hesitate to put forth a question that seems as if it should have such a simple and straightforward answer. However, I find myself unable to attain any such enlightenment on this issue, regardless of where I look. Though I sure the blame lies with my too modest research skills, any help will be most appreciated.#!/usr/bin/perl use strict; use warnings; ### sub datestamp(){ use POSIX; return strftime("%D %r",localtime); } my $var_day = datestamp(); ### print <<HERE; 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? >>&datestamp()<< HERE
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Calling a function from within a HERE doc?
by Anonymous Monk on Aug 16, 2005 at 20:29 UTC | |
Re: Calling a function from within a HERE doc?
by kwaping (Priest) on Aug 16, 2005 at 20:33 UTC | |
Re: Calling a function from within a HERE doc?
by borisz (Canon) on Aug 16, 2005 at 20:31 UTC | |
Re: Calling a function from within a HERE doc?
by borkabrak (Novice) on Aug 16, 2005 at 20:53 UTC | |
by jeffa (Bishop) on Aug 16, 2005 at 21:03 UTC | |
Re: Calling a function from within a HERE doc?
by bart (Canon) on Aug 17, 2005 at 19:06 UTC |