On Tue, 11 Dec 2012 16:47:15 -0500 Alex Ahn <nisnamanar...@gmail.com> wrote:
> I have a problem with a certain script, as a beginner. > > #!/usr/bin/perl -w > # > # Cookie Monster > > $cookie = ""; > > while ( $cookie ne 'cookie') { > print 'Give me a cookie: '; > chomp($cookie = <STDIN>); > } > > print "Mmmm. Cookie.\n"; > $cookie = ""; > while ( $cookie ne 'cookie') { > print 'Give me another cookie: '; > chomp($cookie = <STDIN>); > } > > print "Mmmm. Cookies.\n"; > > When I input 'cookie', the script will print the lines that will > appear from the first and second requests. The script will not print > the second request's demand. I think it's because the ne value is the > same for the two, and I cannot separate the demands unless I change > the ne value for the second demand to 'another cookie'. > You have to eat, er, clear the first cookie. :) -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. Why fit in when you can stand out? Dr. Seuss The only way that problems get solved in real life is with a lot of hard work on getting the details right. Linus Torvalds -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/