Benjamin Ben Ben has written an excellent tool that will grab a user’s Last.FM scrobbles and output them as a CSV file for further manipulation.
The nice thing is that he has made this available as a very straightforward web page where you put in a Last.FM username and a few minutes later you’re prompted to download the CSV file.
Apparently I started using Last.FM on December 8, 2008 and in the intervening 6 years have managed to scrobble 38,600 tracks (these days it helps that Spotify has built-in scrobbling).