#!/usr/bin/perl -l # http://perlmonks.org/?node_id=1173584 use strict; use warnings; my $sequences = "qwertyuiop asdfghjkl zxcvbnm"; my @threes; push @threes, $1 while $sequences =~ /(?=(\w{3}))/g; my $invalid = do { local $" = '|'; qr/@threes/ }; my $password ="asdf"; if( $password =~ $invalid ) { print 'no sequences allowed!'; } else { print "password is okay"; }