# if ($usedpw ne m/$pw/); # should be if( CONDITION ) #no semicolon here { # BLOCK } #### if( $usedpw =~ m/$pw/ ){ #actaully this inverses yourlogic print "Your unique password is: $pw\n"; }