Help for this page

Select Code to Download


  1. or download this
        sub foo {
            # ...
            return wantarray? @foo : \@foo;
        }
    
  2. or download this
        sub foo {
            # ...
            return wantarray? @foo : sub { shift @foo if @foo };
        }
    
  3. or download this
        my @array = foo( $x );
    
        foreach ( @array ) {
            # do something
        }
    
  4. or download this
        my $iter = foo( $x );
    
        while ( my $row = $iter->() ) {
            # do something
        }