in reply to Re^2: Replace arrays in external file
in thread Replace arrays in external file

I showed you an alternative way of writing your eval which does not need any "dots".

To make the "random" values stick to the elements of the @a array, try this:

use Modern::Perl; my @replace = map int(rand(99999)), (0 .. 10); while (<DATA>) { do {print; next} unless /^eval/; s/(?<=\[)(\d+)(?=])/$replace[$1]/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 Deltronics