Help for this page

Select Code to Download


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