in reply to Regex on array elements during push

s/// returns the number of replacements, while m// will return the (portions of the) match. See perlop s/PATTERN/REPLACEMENT/.

While it is possible to DWYW here, it gets complicated and ugly "all-in-one-line". Why not break it down into 2 or more lines, so the next Perler (which may be you) doesn't waste an hour and a bottle of Anacin 26 trying to debug it?

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re: Re: Regex on array elements during push
by carric (Beadle) on Mar 22, 2004 at 20:13 UTC

    I had tried to do a "foreach" on the elements in @array, but I kept getting error mgs, so I wasn't sure if I was trying to do something that couldn't be done.. I am still a newbie.. how would you do it?

    Thank you.