in reply to Questions about split
As to throwing away values, if you want to ignore the first one, just do this: If you're going to ignore the first value, do this:
As to your next part:(undef, $match_I_want) = split /:/, $_, 2;
Sounds like what you really want is this:($user) = split /:/, $_, [1]; ($temp, $foo{$user}) = split /:/, $_, [2];
Finally, what you're doing may be unnecessary. I'm assuming that you're doing a build of /etc/passwd, right? You may also want to look into the getpwnam, getpwuid and related functions and let them take care of the work for you. If you want to read everything from the password file, take a look at getpwent.($user,$name) = split /:/, $_, 2; $name_lookup{$user} = $name;
xoxo,
Andy
--
<megaphone>
Throw down the gun and tiara and come out of the float!
</megaphone>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Questions about split (indexing /etc/passwd)
by blax (Sexton) on Jul 01, 2001 at 12:18 UTC |