For this type of error, after an OSX migration: Use of uninitialized value $version in substr at /loader/0x855460/App/perlbrew.pm line 19. …
The reason is the missing execution bit on a perlbrew perl installation ex: ~/perl5/perlbrew/perls/perl-5.14.2/bin/perl)
From: http://apple.stackexchange.com/a/58701 (Scott Pack)
For various and sundry reasons upgrading the OS requires one to separately upgrade/reinstall MacPorts. The developers have actually created a pretty nice Migration page that details the process necessary to get your ports environment working again after upgrading the OS.
Summarized, the steps you need to follow are:
port -qv installed > myports.txt
This grabs a copy of all installed ports.
sudo port -f uninstall installed
sudo port clean all
I actually sped up my reinstall process by editing the myports.txt file, such that it contained the names (and only the names) of the packages I wanted with one package per line, and running the following command
cat myports.txt | xargs -n1 port install
What this does is go through that file and execute the command port install line for every line in the file. It is a useless use of cat, butwho cares, it's easier to read.