E
Exide Arabellan
Greetings,
In the following code im trying to remove the ending newline (\n) from
$login_attempt and print it to $client.
---
1. #! /usr/bin/perl -w
2.
3. use strict;
4. use IO::Socket;
5.
#.. declaring variables and printing local info to <STDOUT> ..
28.
29. while (my $client = $server->accept()) {
30. $client->autoflush(1);
31. print $client "username: ";
32. while (<$client>) {
33. my $login_attempt;
34. $login_attempt = $_;
35. chomp($login_attempt);
36. print $client "Account '".$login_attempt."' does not exist. Please
try again.";
37. }
38. }
---
Returns:
' does not exist. Please try again.
Instead of:
Account 'foo' does not exist. Please try again.
I tried writing a simple test script using lines 33-36 (replacing $_
with <STDIN> on line 35) and it worked as i had expected. Any thoughts?
Ryan Zander
www.arabellan.com
In the following code im trying to remove the ending newline (\n) from
$login_attempt and print it to $client.
---
1. #! /usr/bin/perl -w
2.
3. use strict;
4. use IO::Socket;
5.
#.. declaring variables and printing local info to <STDOUT> ..
28.
29. while (my $client = $server->accept()) {
30. $client->autoflush(1);
31. print $client "username: ";
32. while (<$client>) {
33. my $login_attempt;
34. $login_attempt = $_;
35. chomp($login_attempt);
36. print $client "Account '".$login_attempt."' does not exist. Please
try again.";
37. }
38. }
---
Returns:
' does not exist. Please try again.
Instead of:
Account 'foo' does not exist. Please try again.
I tried writing a simple test script using lines 33-36 (replacing $_
with <STDIN> on line 35) and it worked as i had expected. Any thoughts?
Ryan Zander
www.arabellan.com