in reply to Re: Parsing user input for AIM bot
in thread Parsing user input for AIM bot
That prints:@words = split /\s+/, <DATA> print join "\n", @words, ""; __DATA__ How are you?
Note that the last word contains punctuation. To remove punctuation, change the first line to:How are you?
Update: Added bit about punctuation.map { s/[\?\.\!]*//g; } (@words = split /\s+/, <DATA>);
$msg =~ s/\bu\b/you/g; # Replace "u" with "you" $msg =~ s/\br\b/are/g; # Replace "r" with "are" ...
|
|---|