For the most part, I agree with the folks above. Try and shoot as many different handguns as you can before buying. Different firearms not only feel different, but have slightly different functional characteristics. Weight plays into those characteristics, as does caliber and barrel length.
That being said, both are fine handguns. I've fired many Baretta Model 92F's (US Military M-9) when I was in the USAF. I never had any issues with them and feel they're a great handgun that can, in my experiences, take a lot of punishment. As an added extra, extra magazines for these handguns are available as MilSurplus for pretty reasonable prices, tho you might have to refurbish with new springs and/or follower.
If given the choice between an M-9 and a Glock for CCW, I'd go with the Glock. They, too, can take a lot of punishment, they're lighter than an M-9, there's a lot of aftermarket extras available for Glock's, people sell surplus magazines for pretty reasonable prices, extended capacity mag's are available, as is a large number of Glock armorer's who can work on them for you. Glock's are also available in nearly every of the common handgun calibers and the magazines for each of the larger pistols will fit in the smaller sized pistols of the same caliber.
Another suggestion I'd like to put out there for handguns that make pretty good CCW's is the Springfield Armory XD line. They're slightly cheaper than a Glock, but in my experiences are just as reliable and are more natural point-shooters - at least to my hand. Something else to think about.