On Wed, Jul 18, 2001 at 10:13:04PM -0400, Bradford Ritchie wrote:
> Could you please explain how your code suggestion below works?  I've been
> staring at it for a long time but it's not getting any clearer.

Certainly.  It's a hash slice.


> >   my %exuser;
> >   @exuser{
> >     qw(root daemon bin sys adm lp uucp nuucp list nobody noaccess nobody4)
> >   } = ();

If we shorten this a bit it'll get a little easier to deal with:

    @exuser{qw(root daemon bin)} = ();

You do know what qw() means, yes?  It splits a string of items on
whitespace, producing a list.  It's effectively:

    @exuser{'root', 'daemon', 'bin'} = ();


Hash slices are documented in perldoc perldata.  They're for assigning a
list of keys to a list of values.  The list of values, in this case, is
empty, so each key gets the value undef.  In short, the above assignment is
equivalent to:

    $exuser{'root'  } = undef;
    $exuser{'daemon'} = undef;
    $exuser{'bin'   } = undef;


Does that clear it up?


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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

Reply via email to