Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Efficient way to verify scalar contents

by choroba (Archbishop)
on Jun 22, 2020 at 09:17 UTC ( #11118354=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @RE = (qr/[[:lower:]]/, qr/[[:upper:]]/, qr/[0-9]/, qr/[^[:alnum:]]
    +/);
    sub check {
    ...
        return if $length < 20 && (! /$RE[0]/ || ! /$RE[1]/);
        return 1
    }
    
  2. or download this
    use List::Util qw{ any };
    
    ...
        return if $length < 20 && any { $password !~ $RE[$_] } 0 .. 1;
        return 1
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11118354]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2021-03-03 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (77 votes). Check out past polls.

    Notices?