sub check_stack { my $stack = $_[0]; if ($stack ~~ @stack) { return 1; } else { return 0; } }