Help for this page

Select Code to Download


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