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:
Program to read through a dummy password file

 



foxy
Deleted

Aug 9, 2000, 1:06 PM

Post #1 of 2 (199 views)
Program to read through a dummy password file Can't Post

Help !! I urgently need some pointers on a simple PERL program !! The prog. has to read through a dummy password file, that should output a list of usernames who are required to change their password.

Format of dummy file is :

username:password:dd/mm/yy:shell


ANY pointers would be gratefully received !!

THANX !!


jbs
Deleted

Aug 9, 2000, 3:21 PM

Post #2 of 2 (199 views)
Re: Program to read through a dummy password file [In reply to] Can't Post

I would use the split command to break up the string as it is read in, then you will have such that the array will be:

$str='username:password:dd/mm/yy:shell';

@all=split(/:/,$str);

or if your reading from a file it would then
be, use the chomp to remove any '\n' chars:

chomp($_);
@all=split(/:/,$_);

Now the array should have the contents of:

all[0]=username
all[1]=password
all[2]=dd/mm/yy
all[3]=shell;

You can the do what ever you need with each element after that.

 
 


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

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