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


in reply to Inserting an element into an array after a certain element

Say, you have "a,b,c,d,e" and want a "f" after "c":
@array = map { $_ eq "c" ? ("c","f") : $_ } @array
but this would insert "f" for each "c" you have.

Alberto Simões