Jeff et al,

>>I have a file which has many strings like "$something[0]" through
>>"something[20]" amongst other text (quotes only provided here for
>>clarity).
>>
>>What I want to do is replace these strings with: "$SOMETHING0" through
>>"$SOMETHING20".
>
>Personally, I find that odd -- moving from an array of 21 elements to 21
>DIFFERENT scalars?!


You're right, it is odd.  But unless I've missed how to take a populated
array and create a usable hash from it to pass to CGI::FastTemplate, this
is what I believe I have to do.


>It should be writing back to file.  If you want to make a backup, give
the
>-i flag an extension:
>
>  perl -p -i.bak -e 's/something\[(\d\d?)\]/SOMETHING$1/g' file

Thanks for this; I was making the mistake of putting a space between the
-i argument and the ".bak" extension.

-Ian




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to