Wouldn't 'getpwnam' be easier to use? (see man perlfunc)

-----Original Message-----
From: Christo Rademyer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 23, 2002 7:39 AM
To: [EMAIL PROTECTED]; Briac Pilpré
Subject: Re: passwd


THANX BIG TIME
----- Original Message -----
From: "Briac Pilpré" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 23, 2002 2:02 PM
Subject: Re: passwd


> Christo Rademyer wrote:
> > $users = '/home/passwd';
> > open( TFH, "<$users" );
> > @data = <TFH>;
> >
> > foreach $line (@data) {
> >     ( $user, $pas, $uid, $gid, $home, $bin ) = split /:/, $line;
> >
> >     print "$user\n";
> > }
> > open LIST, ">>/home/list";
> >
> >  now how do I print all the $user to this file ?
>
>  You can avoid looping twice on your array name by printing in the LIST
>  filehandle just after splitting your string.
>
> #!/usr/bin/perl -w
> use strict;
>
> my $users = '/home/passwd';
> open( TFH,  "< $users" )      or die "Cannot open file '$users': $!\n";
> open( LIST, ">> /home/list" ) or die "Cannot open file '/home/list':
$!\n";
>
> while (<TFH>) {
>     my ( $user, $pass, $uid, $gid, $home, $bin ) = split ( /:/, $_ );
>     print STDIN "$user\n";
>     print LIST "$user\n";
> }
>
> __END__
>
>
> --
> briac
>  << dynamic .sig on strike, we apologize for the inconvenience >>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to