Problem in this "while".

Tyler Gee geekout en gmail.com
Vie Mayo 16 09:34:47 PDT 2008


On Thu, May 15, 2008 at 2:46 PM, GatoLinux <gatolinux en gmail.com> wrote:
> First than all I declare that I am beginner Perl programmer (most probably
> "enthusiast")... I am facing a problem based upon the following code:
>

También, asegúrese de que está utilizando:

use strict;
use warnings;

por todos los programs.

> @list = ();
> $end = "end!";
>
> while ( $directory ne $end ) {
>     print "Directory: ";
>     $directory = <STDIN>;
>         push (@list, $directory);
>         print @list;
>     }
>
> Here's my explanation:
>
> This code should ask for any number of "Directories" defined by $directory =
> <STDIN>;
> and
> the program should stop asking for directories when the user input is: end!
>
> Unfortunately, this last sentence is not being performed. You can check that
> there's not "break" as soon as $end is entered by the user. Then, this
> "while" becomes infinite.
>
> Why do it happens?
>
> It seems like: $directory ne $end is being ignored.
>
> Thanks in advance for your assistance!
>
>
> __
> Costarica-pm en pm.org
> http://mail.pm.org/mailman/listinfo/costarica-pm
>
>



-- 
~Tyler


Más información sobre la lista de distribución Costarica-pm