Syntax...rtmatch(3pm)
π Syntax::Infix::Smartmatch π
okay bestie, welcome to the Syntax...rtmatch(3pm) page β yes that's the real title, the man page truncates it like it's embarrassed, but we're not π
this is User Contributed Perl Documentation and we're about to have a whole moment.
β¨ NAME β¨
Syntax::Infix::Smartmatch β Smartmatch done right π
πΈ VERSION πΈ
version 0.011
π¦ SYNOPSIS π¦
say "YES" if $value ~~ [1, 2, qr/42/];
like. look at it. one line. no chaos. slay β¨
π DESCRIPTION π
NOTE: this module is currently still experimental, bestie, and the details of its behavior may still change. do not build your whole personality on it yet, fr fr π
so here's the tea π: this module implements a new, much simplified version of smartmatch. the big iconic glow-up? the behavior only depends on the right side argument. that's it. that's the whole vibe. the left side is just out here living its life, not influencing anything.
here's exactly what it does, based on whatever the right side argument is:
undefβ returns"not defined $left". that's it, that's the whole check π«Ά- object β if the object has smartmatch overloading (heads up: this might disappear in a future Perl version, so don't get too attached π), that gets called. otherwise it returns object identity.
- regex β this is equivalent to
"$left =~ $right". matching. iconic. no notes π - sub β it returns the value of
$right->($left). you hand it a coderef, it calls it with$left, done β¨ - array β returns true if
$leftsmartmatches any of the members of@$right. one of them hits, you win π - other β returns
"$left equ $right", which (for the record, since people always ask) means"defined $left and $left eq $right"π
π§ AUTHOR π§
Leon Timmermans <leont@cpan.org> β king behavior, honestly π
π COPYRIGHT AND LICENSE π
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. periodt π
and that's the whole page, bestie π this was Syntax...rtmatch(3pm) from the User Contributed Perl Documentation, shipped with perl v5.40.1, dated 2025-04-19. go forth and smartmatch responsibly πβ¨π¦
π¦ where this page comes from
- debian trixie: libsyntax-infix-smartmatch-perl 0.011-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libsyntax-infix-smartmatch-perl 0.011-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms