Copying an Array, with Modifications

in Perl Tips, Data Structures
by William Ward on December 6, 2002 12:24 pm

It is often necessary to make changes to the elements of an array while copying it to a new variable. You might be making a regular expression substitution on each element, or only copying elements that match a certain pattern. In this column I’ll show you three different approaches to this problem, in the spirit of Perl’s motto, "There’s More Than One Way To Do It" (TMTOWTDI):

(more…)