sub trim { my (@out) = @_; foreach (@out) { s/^\s+//; s/\s+$//; } return wantarray ? @out : $out[0]; }