Help for this page

Select Code to Download


  1. or download this
    sub trim {
        @_ = @_ ? @_ : $_ if defined wantarray; # disconnect aliases in no
    +n-void context
    ...
    
        return wantarray ? @_ : "@_";
    }
    
  2. or download this
    foreach (@args) { 
        <...>; 
        trim; 
        <...>;
    }
    
  3. or download this
    foreach (@args) {
        my @b;
    ...
        trim(@b); # silently the same as trim($_) since @b has no elements
        <...>;
    }
    
  4. 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 ? @_ : "@_";
    }