in reply to Re: Losing or overwritting values
in thread Losing or overwritting values
or this:while (<USEDPW>) { my $pw = @chars[map{rand @chars} (1..17)]; } unless ($_ ne $usedpw) { print "Your unique ID is: $pw\n"; }
Whether you like to hug the open brace (example 1) or put it's on it's own line (example 2) is a matter of personal preference - both are correct. However, you really need to line the closing brace up with what started it. Also, i recommend using tabs instead of spaces - you can always use a tool like expand to convert each tab to any number of spaces. For comments to the left of code, well, i try to avoid them, but when i have to have to have them i use spaces to line them up. Keep up the good work. :)while (<USEDPW>) { my $pw = @chars[map{rand @chars} (1..17)]; } unless ($_ ne $usedpw) { print "Your unique ID is: $pw\n"; }
Oh yeah ... you can simplify the unless block like so:
... and double negatives are bad habits, notice that i replaced unless with if and ne with eq.print "Your unique ID is: $pw\n" if $_ eq $usedpw;
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) 2Re: Losing or overwritting values
by sauoq (Abbot) on Jan 05, 2003 at 02:48 UTC | |
by jeffa (Bishop) on Jan 05, 2003 at 16:41 UTC | |
by sauoq (Abbot) on Jan 06, 2003 at 00:04 UTC | |
by Aristotle (Chancellor) on Jan 06, 2003 at 00:20 UTC | |
by sauoq (Abbot) on Jan 06, 2003 at 00:48 UTC |