… sub remove_spaces { my ($input, $junk) = @_ ; $input =~ s/\s+/ /g ; $input =~ s/^ //g ; $input =~ s/ $//g ; chomp($input) ; return $input ; } …