There's more than one way to do things | |
PerlMonks |
Re^2: Removing chars from a word from an arrayby blazar (Canon) |
on Jan 24, 2006 at 16:20 UTC ( [id://525226]=note: print w/replies, xml ) | Need Help?? |
OMG! while and grep to iterate over @list... ok, TMTOWTDI, but then how 'bout a for loop? Also, who told you that @list has duplicates? In any case, if so, then a technique a la'
would suffice. Also, don't you think s///g would be better suited to remove chars from his string? Incidentally to remove charachters, the best tool would be tr///d a.k.a y///d, but unfortunately it does not interpolate - I don't know if it would be worth to use the usual eval trick to work around this limitation. The OP may still want to know just in case he really knew @list in advance and did not need to delete chars dinamically.
How 'bout using a charachter class instead? That is:
In Section
Seekers of Perl Wisdom
|
|