in reply to help me ---regarding string
An exercise question for you, what do you think the reason that running both the print lines above together would result in the following output, But running only a single line of either the two print statements works just fine?!$string = "H e l l o P e r l p r i n t"; print $string for $string =~ s/\b[ ]//g; print $string for $string =~ s/[ ]\b//g; UPDATE:added non-capturing square brackets to account for more efficie +ncy after Anomalous Monk's enlightenment...
Hello PerlprintHelloPerlprint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: help me ---regarding string
by AnomalousMonk (Archbishop) on Oct 06, 2009 at 10:20 UTC |