|
|
| more useful options | |
| PerlMonks |
Re: removing characters using regexby grizzley (Chaplain) |
| on Feb 25, 2009 at 08:31 UTC ( [id://746193] : note . print w/replies, xml ) | Need Help?? |
|
Let's say you are surgeon, and you have some 'human being', which has 'appendix', like this: $h='human be/appendix ing'If you want to cut it out, you do it like this: $h =~ s#/appendix ##;That was the case with you as a perfect surgeon - no scars left. But in real world, real code, leaving scars, would be: $h =~ s#/appendix #~#;Human being has many more things to cut out, of course: kidneys, tonsils, liver: $h = 'h/tonsils uman /first_kidney /second_kidney b/liver e/appendix ing'And if you were crazy enough and willing to perform encores, you would do: $h =~ s#/\w+ #~#gIt's soooo good, that surgeons have no //g flag implemented...
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||