#! perl use strict; use warnings; my @x = qw(Initial list of words 1); my $y = 'Initial string 1'; show('With parentheses'); my @z = ( time() ? @x = qw(Words_z from conditional) : $y ) = foo(); print "\@z = (@z)\n"; show('After assignment to LHS'); @x = qw(Initial list of words 2); $y = 'Initial string 2'; show('Without parentheses'); my @w = time() ? @x = qw(Words_w from conditional) : $y = foo(); print "\@w = (@w)\n"; show('After assignment to LHS'); sub foo { if (wantarray()) { print "\nfoo called in list context\n"; return qw(sub_foo word list); } else { print "\nfoo called in scalar context\n"; return 'String_from_foo'; } } sub show { my ($heading) = @_; print "\n$heading:\n\n"; print "\@x = (@x)\n"; print "\$y = '$y'\n"; }