On 18/02/06 07:49, Damian Conway wrote:
There is already a mechanism for this. You simply turn off all variable interpolation, and interpolate any the variables you wish to interpolate via block interpolations. Or, more simply, only turn on block interpolation in a non-interpolating string:

    my $code = q:c{
        package {$package_name};

        sub {$sub_name} \{
           return {$return_val}
        \}
    };

The curlies then need escaping.  I was seeking a way to avoid escaping
either every set of curlies or every non-interpolated varible (not shown
in your snippet).  It's true that in some case adverb forms may be
useful in reducing backslashing.  The :f form may be better in cases
where [EMAIL PROTECTED] are all common and & is absent or rare.

    sub v { return @_ };

    my $code = q:f{
        package &v($package_name);
        my $increment = 2;

        sub &v($sub_name) {
           return &v($return_val) + $increment;
        }
    };

If &f{$package_name} is legal then that looks even nicer.

Brad

--
 Singlemindedness is all powerful.                      -- Hagakure

Reply via email to