develooper Front page | perl.perl6.users | Postings from August 2022

Inconsistencies with "with" chained to "for"

Thread Next
From:
Fernando Santagata
Date:
August 27, 2022 06:24
Subject:
Inconsistencies with "with" chained to "for"
Message ID:
CAJ+jyGgtqFW38f3HNDTG8BN=2WpMkXStTAHLpeftabgH+NwfKQ@mail.gmail.com
Hello,
I noticed this behavior:

[0] > my @a = <a b c d e>
[a b c d e]
[1] > .say with $_ for @a
()
[2] > .say if .defined for @a
a
b
c
d
e
[3] > (.say with $_) for @a
a
b
c
d
e
[4] > (.say if .defined) for @a
a
b
c
d
e

Apparently in this case "with" works only as a statement modifier while
"if" works both ways.
Is this a known behavior with well understood reasons, or should I open an
issue?

-- 
Fernando Santagata

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About