in reply to Can't modify int in scalar assignment error

int returnCode = SUCCESS;

That looks like C code, not Perl code.    Perhaps you meant:

my $returnCode = SUCCESS;


if ( $returnCode != SUCCESS ) { return $return +Code; } return $returnCode;

That makes little sense.    You are testing $returnCode but you return $returnCode whether it equals SUCCESS or not.