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 and does the right thing.