SPUG:Split question

Brian Hatch spug at ifokr.org
Sat Mar 22 18:01:48 CST 2003



> (undef, undef, undef, undef, undef, undef, $shell) = 
>     split /,/, $line, -1;

or better

($shell) = (split /:/ $line, -1)[6];


or for other examples:

($shell,$username,$gid) = (split /:/ $line, -1)[6,0,2];

Array slices are cool.


--
Brian Hatch                  A picture is worth
   Systems and                a thousand words,
   Security Engineer          but it uses up a
http://www.ifokr.org/bri/     lot more disk space.

Every message PGP signed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/spug-list/attachments/20030322/4cad7f49/attachment.bin


More information about the spug-list mailing list