print "Scalar assignment:\n"; $x = ( context(1), context(2), context(3) ); print "\$x = $x\n\n"; print "List assignment:\n"; @x = ( context(1), context(2), context(3) ); print "\@x = @x\n\n"; sub list { ( context(1), context(2), context(3) ) } print "Scalar assignment in sub:\n"; $x = list(); print "\$x = $x\n\n"; print "List assignment in sub:\n"; @x = list(); print "\@x = @x\n\n"; sub context { my $arg = shift; if(wantarray) { print "$arg: list context\n"; return("oranges", "lemons"); } elsif(defined(wantarray)) { print "$arg: scalar context\n"; return("apples"); } else { print "$arg: void context\n"; return("into the..."); } } __END__ Scalar assignment: 1: void context 2: void context 3: scalar context $x = apples List assignment: 1: list context 2: list context 3: list context @x = oranges lemons oranges lemons oranges lemons Scalar assignment in sub: 1: scalar context # shouldn't this be void context? 2: scalar context # shouldn't this be void context? 3: scalar context $x = apples List assignment in sub: 1: list context 2: list context 3: list context @x = oranges lemons oranges lemons oranges lemons