in reply to Reading from file

Since strings evaluate to themselves, you could just change one line to this:

$hold[$i] = eval "$_";
This would work properly only if you had nothing but strings and regexes in your input file.

And as gaal mentions above, it's very dicy and highly insecure. You're essentially running unknown code -- even if you wrote the contents of the file yourself, a typo can cause havoc.

Update
gaal's comment below is correct. I misspoke. But the warning about eval'ing input strings is still true.

Replies are listed 'Best First'.
Re^2: Reading from file
by gaal (Parson) on Jan 06, 2005 at 23:44 UTC
    Er, no. Strings do not generally evaluate to themselves.

    My suggestion would have evaled only purported regexps, which the author of the config file presumably does want to be interpolated. The other lines in the files don't match the pattern, and are not evaled.

    The warning was about (?{ }) expressions.