Replace trailing whitespaces with pipe symbol using perl

view story

http://www.unix.com – I want to replace the trailing whitespace with Pipe symbol to do a multiple pattern matching. Below is the example mysqld failed start nfsd mount failed rpcbind failed to start expected o/p mysqld failed start|nfsd mount failed|rpcbind failed to start (HowTos)