Help for this page

Select Code to Download


  1. or download this
    sub trim {
        return trim( $_ ) if not @_;
    ...
        for ( @_ ) { s/^\s+//, s/\s+$// }
        return wantarray ? @_ : $_[ 0 ] if defined wantarray;
    }
    
  2. or download this
    sub trim2 {
        return trim2( $_ ) if not @_;
    ...
            if defined wantarray;
        for ( @_ ) { s/^\s+//, s/\s+$// }
    }
    
  3. or download this
    #!/usr/bin/perl
    use strict;
    ...
        undef_passed_1 => sub { my @l = ( '  asdf  ', '  asdf  ' ); trim1(
    + @l ); },
        undef_passed_2 => sub { my @l = ( '  asdf  ', '  asdf  ' ); trim2(
    + @l ); },
    };