use strict;
use warnings;
use 5.010;
my @numbers = (2);
my @other = (2);
if (@numbers ~~ @other) {
say 'yes'
}else{
say 'no';
}
#output: yes
if (@numbers ~~ (2)) {
say 'yes'
}else{
say 'no';
}
#no
####
given (@arr) {
when (()) {say "The array is empty."}
when (34) {say "The array contains 34."}
default {say "Something else."}
}
####
given (@arr) {
my @empty = ()
when (@empty) {say "The array is empty."}
when (34) {say "The array contains 34."}
default {say "Something else."}
}
####
my @arr1 = (2, 34);
say "34" if @arr1 ~~ 34;
#no output...??
####
my @arr1 = ('hello', 'goodbye');
say "array size is 2" if @arr1 ~~ 2;
#no output