I am reading the book Programming Ruby and am looking to upgrade the version of Ruby on my computer. I run Mac OS X Snow Leopard and doing ruby -v in the command line shows I am
As @Andrew Grimm eluded, the problem you are having is likely due to a problem in your $PATH variable. Since macports typically installs stuff in /opt, modifying your $PATH variable to:
$ export PATH=/opt/local/bin:$PATH
Will most likely help. However, I would urge you to look into RVM as @hvgotcodes recommends.