Do you know where your variables are? | |
PerlMonks |
Re: crypt sometimes returning undefby thanos1983 (Parson) |
on Feb 14, 2018 at 11:59 UTC ( [id://1209131]=note: print w/replies, xml ) | Need Help?? |
Hello Beaker, I was reading the documentation of crypt and I noticed from the sample code:
They are using first the word and then the password. It is not related to your problem but I think it would be more clear in future reference:
The only reason that I can imagine that you might have $cryptedpass as blank is that you have $never_blank_value. You are using substr and you are cutting off the first 2 characters of the string. In case the string it has less than 2 characters then you will end up with undef value. Sample of proposed code:
Sample of error:
Update: Based on the link 0007695: Crypt bug that fellow Monk poj point it out you might be passing non acceptable characters. If this is the case add this to your code:
Hope this helps, BR.
Seeking for Perl wisdom...on the process of learning...not there...yet!
In Section
Seekers of Perl Wisdom
|
|