CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
probably been asked before but...

 



ultimategamer2k
User

Jan 27, 2001, 11:19 AM

Post #1 of 4 (416 views)
probably been asked before but... Can't Post

can someone tell me how to make a script that opens a text file, and looks for a user/password?
like
username:password
and where i can add other usernames/passwords

visit my web site at http://ultimategamer.cjb.net


modified
Deleted

Jan 27, 2001, 1:18 PM

Post #2 of 4 (412 views)
Re: probably been asked before but... [In reply to] Can't Post


Code
open (UP, "$file") || die "Cant open $file, $!"; 
flock (UP, 2);
while (<UP>) {
$_ =~ /(.+?):(.+?)/ig;
$user = $1;
$pwd = $2;
}
close (FILE);

Probably doesn't work, but I don't know. :)



zanardi
journeyman

Jan 27, 2001, 8:03 PM

Post #3 of 4 (404 views)
Re: probably been asked before but... [In reply to] Can't Post

you dont need to use flock when opening a file

or is preffered over || in that situation, I think this would be suffeciant:


Code
open(F,$file) or die $!; 
my @data = <F>;
close F;
my ($user,$pass) = split(/:/,$data[0]);

:)

My BBS


ultimategamer2k
User

Jan 28, 2001, 7:24 AM

Post #4 of 4 (397 views)
Re: probably been asked before but... [In reply to] Can't Post

zanardi!
thanks a bunch dude!
but authorize me on icq damn it!

visit my web site at http://ultimategamer.cjb.net

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives