| Syntax::Infix::Smartmatch(3pm) | User Contributed Perl Documentation | Syntax::Infix::Smartmatch(3pm) |
Syntax::Infix::Smartmatch - Smartmatch done right
version 0.010
say "YES" if $value ~~ [1, 2, qr/42/];
NOTE: This module is currently still experimental and the details of its behavior may still change.
This module implements a new, much simplified version of smartmatch. In particular the behavior only depends on the right side argument. In particular it will do the following based on the right side argument:
This will return "not defined $left".
If the object has smartmatch overloading (note: this might disappear in a future Perl version), that is called. Otherwise it returns object identity.
This is equivalent to "$left =~ $right".
It will return the value of $right->($left)
This will return true if $left smartmatches any of the members of @$right.
This will return "$left equ $right" ("defined $left and $left eq $right").
Leon Timmermans <leont@cpan.org>
This software is copyright (c) 2023 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| 2024-10-15 | perl v5.40.0 |