my $crypted ; { my $checker = My::Password::Checker->new() ; my $password = ; chomp $password ; die "too short!" unless length $password < 4 ; die "too obvious" if $checker->check_obvious($password) ; # other tests go here... my $salt = generate_random_salt() ; $crypted = crypt($password,$salt) ; } # $password, $salt, $checker and any other variable # declared by my inside the block disappear here :-) # $crypted was declared outside the block, so I can... do_whatever_with($crypted) ;