sub myTrim { my $str = shift; #shift faster than @_ for one paramater $str =~ s/^\s*//; #no space at front $str =~ s/\s*$//; #no space at rear return $str; } #### $str =~ s/^\s+//; # no whitespace at front $str =~ s/\s+$//; # no whitespace at rear