sub trim { my $string = shift; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; } 转载于:https://blog.51cto.com/zorro/1132234