in reply to Unix

You're in luck. O'Reilly's Perl for System Administration has an entire chapter devoted to parsing log files in Perl.

Even better, it's available online. Not only does it have an example on how to decode the binary format of wtmp files with unpack(), but it even has an example on using the 'last' command from within Perl.