in reply to Most Efficient Way to match this

The "most efficient" method would depend on what you're going to do with the lines that don't match. If you're going to be splitting them into fields, then you might as well split the line first and check the userid with a simple eq:

while(<$file>){ my @fields = split ':'; last if $fields[0] eq $userid; }

But if you're not doing that, then it's probably more efficient to leave the line as it is and do a simple regex check:

while(<$file>){ last if /^$userid:/; # do whatever }

One more note: if there's any chance that the userid field (or perhaps other fields) could contain colons, either escaped or quoted, you should probably use a module like Text::CSV to handle that properly.

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.