in reply to Late evaluation of a string.
and you want to pass in a format string, look at the 'sprintf' function instead. You can then do things like:$result = "And the answer is $var1 (or $var2 percent)";
printit( "The answer is %s (or %d percent)" ); sub printit { $format = shift @_; # Passed in to function ...set variables... $result = sprintf( $format, $var1, $var2 ); }
|
|---|