Help for this page

Select Code to Download


  1. or download this
    sub trim {
        for (@_) {
    ...
            s/\s+$//;
        }
    }
    
  2. or download this
    subtest 'trim' => sub {
        is("leading", trim("   leading"), "trim: leading");
        ... more test cases ...
    };
    
  3. or download this
    sub trim {
        for (@_) {
    ...
            s/\s+$//;
        }
    }
    
  4. or download this
    subtest 'trim' => sub {
        my @test = ("  leading", "trailing  ", "  both  ");
    ...
        is("'leading', 'trailing', 'both'", $out, "trim: list");
        done_testing();
    };