Hmm. Any particular reason to only sort on the first 8 characters of the last name? Unless your names are really really long (and perhaps not even then) I don't think it will make a difference to your output if you sort on the entire last name. That way you can avoid the custom sort routine.
Some other minor nits to pick:
You call to 'flock', presumably to make sure that the database is in a consistent state when you read it. Fair enough. Make sure, though, that you read the help for 'flock' (perldoc -f flock). This mentions that the locking is advisory and so all pieces of software which interact with the DB must call flock or the one which doesn't won't even notice the locks which the others hold.
Your use of "magic numbers" '2' and '8' jarred enough to make me look up the constants. '2' is LOCK_EX and '8' is LOCK_UN, which I believe are 'exclusive lock' and 'unlock'. Since you are only reading the database you probably don't need an exclusive lock, a shared lock would do - and would allow multiple readers.
If your code ends up getting used in a CGI script an exclusive lock would mean that only one instance at a time could read the file - an interesting performance bug for the maintainer to track down in 12 months time when the file is huge - made much worse by using numbers and not names for the parameters.