You can modify pipeline objects on-the-fly using Foreach-Object. The syntax is a little strange because you need to put the object back on the pipeline if desired for additional processing. WordPress.com code-sanitization is eating my $_ so trying Gist, BLAH.
The key thing to remember here is that the extra $_ at the end of the foreach script block is used to put the modified object back on the pipeline. This is then available to the sort cmdlet and any later pipeline operations.
The pipeline concept in powershell can be a little strange at first, but it is a powerful way to work quickly with structured data.