How about brackets around your utime arguments, to prevent the boolean OR operator from binding your error handling (die) to your third argument? I'd change || to or.
Your second substitution regex squishes the last two characters in the filename if the last character is whitespace. Is this what you wanted?