http://qs321.pair.com?node_id=312229


in reply to split every second word

broquaint is pretty much right on. Given your example input, it'll work.

As to removing spaces, the following will do it:

my $str = "Bob "; $str =~ s/\s$//; # or s/ $//; print "|$str|\n";

If things get any worse, I'll have to ask you to stop helping me.