#!perl open (FILEH, "/etc/passwd"); #open the file for read while () { #while there are still lines in FILEH... chomp; #clear newlines... if ( /root/i ) { # if line contains "root" case insensitive` ($username,$id) = (split /:/)[0,2]; #pull out field one and th +ree print "User: $username, ID: $id\n"; #print junk } }