- or download this
sub trim {
@_ = @_ ? @_ : $_ if defined wantarray;
...
# defined values, if any. Otherwise just return.
}
- or download this
@trimmed = trim(@not_trimmed);
- or download this
foreach (@untrimmed) {
say trim;
}
- or download this
sub trim (_;@) {
# ... as above
...
my @data = (' a', ' b ' , 'c ');
say trim (@data);