diff --git a/cli/operators.pl b/cli/operators.pl index a955f40..7609012 100644 --- a/cli/operators.pl +++ b/cli/operators.pl @@ -1,6 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; +use 5.0100; sub println { @@ -132,3 +133,22 @@ print 1 .. 20, "\n"; print '&' .. '!', "\n"; print 10 .. -10, "\n"; print "$_\n" foreach 1 .. 10, "\n"; + + +my $scalar = 'hi'; +my @array = qw(one two three); +my %hash = ( + hi => 1, + ho => 2, + he => 3, +); + +if ($scalar ~~ @array) { + print "scalar matches array\n"; +} +if ($scalar ~~ %hash) { + print "scalar matches hash\n"; +} +if (@array ~~ %hash) { + print "array matches hash\n"; +}