in reply to Split a string into individual words
# --- Part one --- @single = qw(I sit here and think- what the-hell am i doing with perl?); foreach (@single) { s/[,.?-]//g; # Updated: strip punctuation print "$_\n"; } # --- Part two --- $a= "I sit here and think- what the-hell am i doing with perl?"; $a=~ s/[,.?-]//g; print "$_\n" for $a =~ /(\w+)/g;
I sit here and think what thehell am i doing with perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (2) Split a string into individual words
by pzbagel (Chaplain) on Feb 06, 2004 at 01:14 UTC | |
by Roger (Parson) on Feb 06, 2004 at 01:21 UTC |