in reply to Re: ... for (@_) x= 2; (scalar assignment)
in thread ... for (@_) x= 2;
OUTPUTS:#!/usr/bin/perl use warnings; use strict; $\ = $/; $, = '+'; print qw/a b/ x 2; print scalar(qw/a b/ x 2); print for (qw/a b/ x 2) x 2; print for qw/a b/ x 2 x 2;
a+b+a+b
bb
a b a b a b a b
The strange for me is the output of second 'print' (of course so does 4th too): it prints "bb" instead of supposed "b". I don't catch that, because print scalar('a','b','a','b'); would print "b".bbbb
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: ... for (@_) x= 2; (scalar assignment)
by LanX (Saint) on Dec 29, 2015 at 14:32 UTC | |
by rsFalse (Chaplain) on Dec 29, 2015 at 14:38 UTC | |
by LanX (Saint) on Dec 29, 2015 at 14:56 UTC | |
by ikegami (Patriarch) on Dec 29, 2015 at 15:07 UTC | |
by LanX (Saint) on Dec 29, 2015 at 15:17 UTC | |
|