in reply to Re^2: Cutting last word from a output line
in thread Cutting last word from a output line

Replace \w (word character) with \S (non-whitespace) in the regular expression and it should work.

my ($variable) = `your command` =~ /(\S+)$/;