libfile-path-expand-perl | expand user directories in filenames | Mehr ...
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 getpwent and does the right thing.