>>>>> "RD" == Rob Dixon <[email protected]> writes:
RD> use strict;
RD> use warnings;
RD> my $str;
RD> sub var { "$str abc_xyz" }
RD> for my $i (1 .. 5) {
RD> $str = $i;
RD> my $line = 'Line: ' . var;
RD> print "$line\n";
RD> }
using a global to get around symrefs is not a win. a template or sprintf
are much better solutions. even a one liner with a hash and s/// is
simple and effective for this (it is the simplest templater around).
uri
--
Uri Guttman ------ [email protected] -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/