in reply to Check multiple array elements for a single condition
You could also use the Smart::Match module with smartmatching:
Or you could do exactly the same thing "natively", in Perl 6:use Smart::Match 'all'; if ( 0 ~~ all(@array[0,1]) ) { say 'matched'; }
Damianif @array[0 & 1] == 0 { say 'matched'; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Check multiple array elements for a single condition
by Linicks (Scribe) on Aug 25, 2016 at 18:12 UTC | |
by afoken (Chancellor) on Aug 25, 2016 at 18:35 UTC | |
by Linicks (Scribe) on Aug 25, 2016 at 18:40 UTC | |
by afoken (Chancellor) on Aug 25, 2016 at 18:47 UTC | |
by Linicks (Scribe) on Aug 25, 2016 at 18:58 UTC | |
by RonW (Parson) on Aug 26, 2016 at 19:37 UTC | |
by afoken (Chancellor) on Aug 27, 2016 at 10:05 UTC | |
Re^2: Check multiple array elements for a single condition
by Anonymous Monk on Sep 10, 2016 at 16:00 UTC |
In Section
Seekers of Perl Wisdom