- or download this
sub trim {
@_ = @_ ? @_ : $_ if defined wantarray; # disconnect aliases in no
+n-void context
...
return wantarray ? @_ : "@_";
}
- or download this
foreach (@args) {
<...>;
trim;
<...>;
}
- or download this
foreach (@args) {
my @b;
...
trim(@b); # silently the same as trim($_) since @b has no elements
<...>;
}
- or download this
sub trim {
if ( !@_ && !defined(wantarray) ) { carp 'Useless use of trim with
+ no arguments in void return context (did you mean "trim($_)"?)'; ret
+urn; }
...
return wantarray ? @_ : "@_";
}