in reply to Re^2: inserting array of data into text file
in thread inserting array of data into text file

s/^(\S\s+\S)/$1 $col[$i++]/e; - you have code you need executed in the replacement half of the substitution. Perl doesn't do that unless you tell it to.

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

I shouldn't have to say this, but any code, unless otherwise stated, is untested

Replies are listed 'Best First'.
Re^4: inserting array of data into text file
by bart (Canon) on Jul 14, 2004 at 00:51 UTC
    Wrong. He wants it as a string, so it shouldn't have an /e. Quite the contrary, adding an /e would make his syntax invalid. You didn't even test your code, did you?

    The only code I see is in the array index, and code in array or hash indexes is always executed, if the variable will be interpolated — thus: in double-quotish context. That's how the module Interpolation works.

      I think people get confused because of the /e being optional if there's just one thing there (e.g. s/(\S+)/$translate{$1}/e; is equivalent to s/(\S+)/$translate{$1}/;).