[Techtalk] On Perl
Hamster
hamster at hamsternet.org
Sun Jul 28 20:09:33 EST 2002
hehe. the neat trick is you could get this even 'conciser'
> !/usr/bin/perl
> @words = qw (llama camel alpaca);
> print "what is your name\n";
> $name = <stdin>;
> chomp $name;
> if ($name eq "tan") {
> print "hey man\n";
> } else {
> print "hi, $name\n";
> print "enter the password\n";
> while (true) {
> $guess = <stdin>;
> chomp $guess;
> if (grep (/^$guess$/, @words)) {
> last;
> }
> print "wrong. try again\n";
> }
> }
>
More information about the Techtalk
mailing list