in reply to Script failed with certain value in the variable

The line that reads:

if (!defined(Suffix) && defined($version))

was almost certainly intended to be

if (!defined($suffix) && defined($version))

strict would have caught the mistake. !defined(Suffix) should always return false if the code runs. strict and warnings were also recommended by other replies.

Ron