| |||||||
|
|
Click here to download plain text source code.
# subroutine name: macro_process # Input: string # If input string starts with "&", all the rest text # is considered as perl script to be executed, and # subroutine returns result of script work. # Otherwise returns passed input string unchanged. # Usage example: macro_process("Plain text"); # Result: "Plain text" # Usage example: macro_process("& 2+2"); # Result: "4" sub macro_process { my ($templatetext) = @_; if ($templatetext=~m/^&(.+)/s) { evaluate($1); } else { $templatetext; }; } |
|||||||||||||||||||||
| Copyright © 1999-2007 Atomicsoft Ltd. All Rights Reserved. | ||