my $cmd = 'ps efax 2>/dev/null|grep firstbo|grep -v grep|wc -l'; my $stat = $ssh->exec($cmd); print "Before chomp: " , length($cmd); print "|".$stat."|"; chop $stat; print "|".$stat."|"; print "After chomp: " , length($cmd);