Before your 2nd while loop, add:

$cookie = "";



> 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";
>
> 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'.
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>
>


-- 



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to