in reply to Variable messes up loops.

If you run perltidy over it you will also notice that the indentation seems odd - it never returns to the left margin. This is because you are one } short which perl notes as this script does not actually compile.

#!/bin/perl use IO::Socket; use IO::Select; $/ = "\015\012"; $nconnections_new = 0; $login = ""; $maxconn = SOMAXONN; $local = IO::Socket::INET->new( Proto => "tcp", LocalPort => "1234", Listen => $maxconn, Reuse => 1 ) or die "Can't open socket\n"; while ( $client = $local->accept ) { $client->autoflush(1); &start; sub start { print $client "This is a test BBS!\n\r"; print $client "(C)reate new user (L)ogin"; print $client "\n\r"; my $option = <$client>; chomp $option; $option = "\U$option\E"; if ( $option eq "C" ) { print $client "<<<Create new user>>>\n\r"; print $client "Login must be at least 6 characters.\n\r"; &login; } elsif ( $option eq "L" ) { &logon; } else { &start; } sub login { $/ = "\015\012"; print $client "username:"; $login = <$client>; chomp $login; if ( $login eq "" ) { print $client "Must enter a username!\n\r"; &login; } $/ = "\012"; open( FILE1, "users.txt" ) || print "Error occured while opening file"; while (<FILE1>) { ( $first, $second ) = split /:/; print $first; if ( $login eq $first ) { print $client "Sorry this username has been taken, try again!\ +n\r"; &login; } $/ = "\015\012"; } close(FILE1); if ( length($login) > 7 ) { print $client "Your username was longer than 6 charact +ers!\n\r"; &login; } $pass = password(); sub password { print $client "Password:"; $password = <$client>; chomp $password; print $client "\n\rRe-enter password:"; $password2 = <$client>; chomp $password2; if ( $password ne $password2 ) { print $client "Passwords do not match, try again!" +; &password; } return $password; } open( FILE, ">>users.txt" ) || print "Error occured while opening file"; print FILE "$login:$pass\n"; close(FILE); print "File written..\n\r"; exit; } } sub logon { print $client "test"; } close $client;

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print