in reply to The behavior when assigning an array to scalar?
In a way, it's similar to using semi-colons to separate statements that are grouped together:
The above also prints "bbb" -- but if you have warnings on, it will also warn you that the first 3 items are ignored:my $s = do {"111"; "222"; "aaa"; "bbb"}; print $s."\n";
> perl -e ' use warnings; my $s = do {"111"; "222"; "aaa"; "bbb"}; print $s."\n";' Useless use of a constant ("111") in void context at -e line 3. Useless use of a constant ("222") in void context at -e line 3. Useless use of a constant ("aaa") in void context at -e line 3. bbb
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: The behavior when assigning an array to scalar?
by haukex (Archbishop) on Sep 27, 2017 at 08:10 UTC | |
by perl-diddler (Chaplain) on Sep 27, 2017 at 14:59 UTC | |
by choroba (Cardinal) on Sep 27, 2017 at 20:29 UTC |