Or use eval("$a[1]$a[0]$a[2]"); It will save you a few keystrokes.
Your program then can become:
use Modern::Perl; while (<DATA>) { do {print; next} unless /^eval/; s/(?<=\[)\d+(?=])/int(rand(99999))/ge; print; } __DATA__ @a = ("'hello world'",'print ', ';'); eval("$a[1]$a[0]$a[2]");
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial DeltronicsIn reply to Re: Replace arrays in external file
by CountZero
in thread Replace arrays in external file
by astroid96
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |