Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Accessing a file from the perl

by abcdefg (Acolyte)
on Jan 11, 2012 at 23:22 UTC ( [id://947452]=note: print w/replies, xml ) Need Help??


in reply to Re: Accessing a file from the perl
in thread Accessing a file from the perl

Did you mean to say adding a chomp function after reading the file,like below:

$user = <$client_socket>; chop($user); #remove the \n print "$prefix USER = $user\n"; unless (open (USERNAME, "username")) { print "ERROR:Cannot open username file.\n"; exit(1); # ERROR } while(<USERNAME>) { my @newusername = <USERNAME>; chomp($newusername); foreach $name (@newusername) { if($name ne $user) { print $client_socket "ERR\n"; print "$prefix ERROR: user $user not permitted to use +this mode. Exiting.\n"; close(USERNAME); exit(1); } } } #else, continue print $client_socket "ACK\n"; # approve the user. close(USERNAME);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://947452]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2024-04-23 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found