Software >> Development >> Languages >> Perl >> How to strip spaces from the beginning or end of a string

# To strip spaces from end of a string # $string =~ s/\s $//; # To strip spaces from beginning of a string # $string =~ s/^\s //;