http://www.perlmonks.org?node_id=151985


in reply to array problem

Your immediate problem is here:

s/%%images%%/@arr/g;

Try:

s/%%images%%/shift(@arr)/eg;

This will remove and use the first element of @arr as a replacement. Note the addition of the 'e' modifier, to evaluate the replacement expression.

Not sure why using @arr in s// yields a single item. The item it picks seems to be arbitrary as well.

Also, shoot for 'use strict;' on all your programs and quit using global variables.

YuckFoo