#!/usr/local/bin/perl use feature qw{ switch }; use strict; use warnings; sub match { my $i = 0; my $foo = shift; print $foo . ': '; given ( $foo ) { when ( /^Just / ) { $i++; continue; } when ( /another / ) { $i++; continue; } when ( /[Pp]erl / ) { $i++; continue; } when ( /hacker\.?$/ ) { $i++; } } print 'Me too!' if 4 == $i; print "\n"; } match 'Just another Perl hacker'; match 'Just another Perl slacker';