Help for this page

Select Code to Download


  1. or download this
    @x = foo();     # foo called with list context
    $x = (foo());   # foo called with scalar context
                    # note parens have no effect
    $x = (foo())[@foo]; # foo called with list context
    
  2. or download this
    @x = foo();     # foo called in list context
    $x = (foo());   # foo called in scalar context
                    # note parens have no effect
    ($x) = foo();   # foo called in list context, note lack
                    # of parens around foo has no effect
    
  3. or download this
    foo() x 2;        # foo called in scalar context
    $x = foo() x 2;   # foo called in scalar context
    ...
    (foo()) x 2;      # foo called in void context
    $x = (foo()) x 2; # foo called in scalar context
    @x = (foo()) x 2; # foo called in list context