in reply to Re: Efficient way to verify scalar contents
in thread Efficient way to verify scalar contents
Thanks for replying!
A little confused on the purpose of
$index= min( int(length /4), 5 )
length being the passwordLength?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Efficient way to verify scalar contents
by perlfan (Vicar) on Jun 22, 2020 at 05:48 UTC | |
TBH it's not clear enough to make great sense to me, but he appears to be suggesting that you put your ranges into buckets based on the formula he gave; for a length of 20 or more, you're always going to fall into bucket 5 (or perhaps element 3) of your array of checks. This is actually a pretty good way to determine a bucket, so then you can have an array of checks; or to make it more clear, a hash:
| [reply] [d/l] [select] |
Re^3: Efficient way to verify scalar contents
by LanX (Saint) on Jun 22, 2020 at 11:40 UTC | |
I meant something like this:
Cheers Rolf
UPDATE | [reply] [d/l] [select] |
by LanX (Saint) on Jun 22, 2020 at 12:04 UTC | |
you may also want to limit the max length of your password.
Cheers Rolf
UPDATE | [reply] [d/l] [select] |
by haukex (Archbishop) on Jun 22, 2020 at 13:17 UTC | |
Note that both of your solutions don't report an error for e.g. 'aaaaaaaaa0-' and 'aaaaaaaaaaaaaaaaaaa', which are invalid as per the OP's code. | [reply] [d/l] [select] |
by LanX (Saint) on Jun 22, 2020 at 13:22 UTC |
In Section
Seekers of Perl Wisdom