On Sep 16, KYu said:

>I was confront  with a such question: how to define the strings, which
>should be interpolated every time when it met?
>
>For example, this code
>
>$var1 = "one";
>$str = "number $var1, ";
>print $str;
>
>$var1 = "two";
>print $str;
>
>produce "number one,  number one" to the output. But what I must to do, that
>output would be
>"number one, number two" ??

You could use my DynScalar module from CPAN:

  use DynScalar;

  my $var;
  my $str = dynamic { "number $var," };

  $var = "one"; print $str;
  $var = "two"; print $str;

-- 
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to