Problems? Is your data what you think it is? | |
PerlMonks |
Re:^2 Oooh, Oooh, Help Me Help Me (:)by ChemBoy (Priest) |
on Oct 28, 2001 at 09:11 UTC ( [id://121799]=note: print w/replies, xml ) | Need Help?? |
No, please don't use grep that way, unless you actually want to strip lines out of your input if they don't match the substitution pattern. Use map, instead--that's what it's for.
Note that the first solution proposed using grep wouldn't have the undesired side-effects, but it's still bad coding practice--never use grep or map in void context (obfuscatory and inefficient). And Kage, please find a better descriptive title for your question next time... Update: or, of course, you could alter the array in place after reading it in, using
Update 2: of course, it would help if I told you the right syntax for map, too... (thanks, Zaxo! And I wish I had as good an excuse as jj808 for screwing this one up....) If God had meant us to fly, he would *never* have given us the railroads. --Michael Flanders
In Section
Seekers of Perl Wisdom
|
|