John W. Krahn wrote:
> Steve Bertrand wrote:
>> John W. Krahn wrote:
>>> John Plum wrote:
>>
>>>> #---Assemble/concatenate references in both ascii and html, to make
>>>> full confirmatory message bodies with order details---
>>>>
>>>> $scalar_sig = "\printFile($signature)";
>>> You can not call a subroutine from inside a string.  Just the $signature
>>> variable and the backslash get interpolated.
>>
>> Not to take away from any of the great feedback you supplied to the OP,
>> or to be ignorant or argumentative in any way, but I recently found it
>> handy to use something similar to this ( personally ) unrecommended and
>> noisy piece of syntax to extract the result of a function within quotes:
>>
>> #!/usr/bin/perl
>>
>> use warnings;
>> use strict;
>>
>> my $string = "d'oh";
>>
>> my $return_from_sub_in_quotes = "${\( marine( $string ) )}";
> 
> As described in:
> 
> perldoc -q "How do I expand function calls in a string"
> 
> The problem with that particular idiom is that although it *looks* like
> a scalar the function is called in *list* context.
> 
> $ perl -le'
> sub context {
>     defined wantarray ? wantarray ? "LIST" : "SCALAR" : "VOID"
>     }
> print "${ \( context ) } : ${ \( scalar context ) } : @{ [ context ] } :
> ", context, " : " . context . "";
> '
> LIST : SCALAR : LIST : LIST : SCALAR

Nice, thanks!

Steve

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to