Have you thought about using File::Spec->catfile instead?
In reply to Re^3: Check last character of a string by Corion in thread Check last character of a string by theroninwins