sub foo { wantarray ? 3 : 5; } my @x; @x[2] = foo(); my $x = foo(); print "$x[2] <-> $x\n";