in reply to While loops with if

You're missing something blatantly obvious. There is no semi-colon after the condition for an if. To rewrite your example, it should look like:
while (1) { my @chars = ( "A" .. "Z", "a" .. "z", 0 .. 9, qw(! @ $ % ^ & *) ); if ($usedpw ne m/$pw/) { print "Your unique password is: $pw\n"; } }
A few notes:
  1. You'll notice the indentation I used. This helps a ton when trying to read code with control structures (like loops, conditionals, etc.)
  2. Read Intro to Perl, aka the Llama book. You are trying to program without learning how to program. This will frustrate you to no end.
  3. Ask your teacher these questions, not us. :-)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.