Problem in this "while".

GatoLinux gatolinux en gmail.com
Jue Mayo 15 13:46:59 PDT 2008


First than all I declare that I am beginner Perl programmer (most probably
"enthusiast")... I am facing a problem based upon the following code:

@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!
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://mail.pm.org/pipermail/costarica-pm/attachments/20080515/db590a0d/attachment.html 


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