File::Path::Expand expands user directories in filenames.  For the
simple case it's no more complex than s{^~/}{$HOME/}, but for other
cases it consults C<getpwent> and does the right thing.

WWW: http://search.cpan.org/dist/File-Path-Expand/