String comparison operators eq and ne

The eq and ne operators compare two strings and return a Boolean value.

say 'abc' eq 'abc'; # Truesay 'abc' ne 'def'; # True

The non-string operands are converted to strings before comparison, as follows:

say 13 eq '13'; # True

To compare numbers, use the == and != operators.

Get Perl 6 Deep Dive now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.