Why not use contains though? perl6 -e 'say "abc".contains("z")' False
Use index if the index is important. Use contains if you just want to know if it's there. On Tue, 11 Sep 2018 at 10:57 JJ Merelo <jjmer...@gmail.com> wrote: > perl6 -e 'say "abc".index("z") =:= Nil ?? "False" !! "True"' > > -e runs the script from the CL > https://github.com/rakudo/rakudo/wiki/Running-rakudo-from-the-command-line > "abc" is on front (but it could be in the same way) > index return Nil if it does not found (more logical than -1) > https://docs.perl6.org/routine/index; it's a constant, so you have to use > =:= to check for equality. https://docs.perl6.org/routine/=:= > ??!! is the ternary operator in Perl 6 > https://docs.perl6.org/language/operators#index-entry-operator_ternary-ternary_operator > > > JJ > PS: ObStackOverflow plug. > -- Simon Proctor Cognoscite aliquid novum cotidie