use strict; use warnings; my @pwstruct = getpwnam('me'); my $plain = '****'; my $encrypted = $pwstruct[1]; if ( crypt( $plain, $encrypted ) eq $encrypted ) { print "ok"; }