use Cracklib qw(crack); my $root_password = crack((getpwuid(0))[2]); ...