in reply to While loops with if

Your actaul problem is indeed a syntax error:

# if ($usedpw ne m/$pw/); # should be if( CONDITION ) #no semicolon here { # BLOCK }

There's also something wrong about your if-condition, as it compares (ne does string-comparison) $usedpw to the result of matching whatever is in $pw on $_. This should confuse you, you probably want to use =~

if( $usedpw =~ m/$pw/ ){ #actaully this inverses yourlogic print "Your unique password is: $pw\n"; }

I can't see the sense of this, no matter if you check for "matches" or "doesn't match".

Finally your loop is an endless loop, a very popular mistake, but it looks like you wanted an endless loop because of while(1).

So, what's this code supposed to do?

--
http://fruiture.de