in reply to Re^2: Scalar range operator again
in thread Scalar range operator again
I have read all those articles on the internet. But nowhere was described this counterintuitive behaviour.Maybe it's just me, but perldoc's "It can test the right operand and become false on the same evaluation it became true (as in awk), but it still returns true once." seems to describe exactly this behavior. I'd even call it a clear description.
they point out that perl -we'my @l = qw/ac qw/; for (@l) { print if /a/../c/ }' would print ac and the same only with three dots prints acqw. This is completely understandable but not the case with @l = qw/ca qw/.I don't get what you mean here. qw/ac qw/ and qw/ca qw/ are treated identically by the flip-flop operator:
$ perl -E 'my @l = qw/ac qw/; for (@l) { say if /a/../c/ }' ac $ perl -E 'my @l = qw/ca qw/; for (@l) { say if /a/../c/ }' ca
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Scalar range operator again
by kejv2 (Acolyte) on Jul 07, 2012 at 10:33 UTC | |
by Anonymous Monk on Dec 15, 2012 at 07:58 UTC |
In Section
Seekers of Perl Wisdom