#pseudocode my @commands=qw(ls rm rd cat....); for $command(@commands) { if ($command =~ /(your regex here)/ ) { say "regex matched $command"; } else { say "Oops! $command slipped by"; } }