If I declared a variable $myString with the value \'3 \' (notice the white space). Is there any function to remove the white space for the return v
$myString
\'3 \'
$myString =~ s/^\s*(.*?)\s*$/$1/;
This will trim whitespace from both sides.
from just the right:
$myString =~ s/\s*$//;