【发布时间】:2011-03-10 22:20:21
【问题描述】:
如何使用带有 split 功能的 map 来修剪成分:$a、$b、$c 和 $d; $line 的?
my ($a, $b, $c, $d, $e) = split(/\t/, $line);
# Perl trim function to remove whitespace from the start and end of the string
sub trim($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
【问题讨论】: