use strict; use warnings; my $pw = '6yJi'; my $salt = 'uppu'; my $encpw = crypt $pw, $salt; print $encpw. "\n"; print "Your password: " ; chomp (my $readpw = ); if($encpw eq crypt ($readpw, $encpw)) { ================> even if $encpw is replaced with $salt it works, both work. print "Password OK\n"; }else { print "Password NOT OK\n"; }