in reply to How do I reverse a string or the words in a string?
#lie about myself $str='i am a sexy bastard'; #split the words @words=split ' ', $str; #revers 'em @words=reverse @words; #join 'em $reversestr=join ' ', @words;
Edit by tye to include wine's suggestion
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Answer: How do I reverse a string or the words in a string?
by wine (Scribe) on Jul 21, 2001 at 14:19 UTC |