in reply to Cutting last word from a output line
The OP cross posted this on perlguru and possibly other forums.