Hi Parag, On Sunday 17 Apr 2011 21:07:27 Parag Kalra wrote: > Hi, > > I am not sure if this can be done. But just asking it out of curiosity. I > have written this snippet. > > use strict; > use warnings; > > my $var = '$str abc_xyz'; > my $str; > > for(my $i=1;$i <= 5; $i++){ > $str = $i; > my $line = 'Line: '.$var; > print "$line\n"; > } >
The proper way to do it is to use a templating engine. See: http://perl-begin.org/uses/text-generation/ http://perldoc.perl.org/functions/sprintf.html should be enough here. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ "The Human Hacking Field Guide" - http://shlom.in/hhfg Judaism: God is all the shit, all the non-shit and all the intermediate demi-shits in between. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/