in reply to Re: Variable assignment confusion
in thread Variable assignment confusion

Which is (factoring out the common prefix):
my $new_retid = $retid . ($retid =~ /_\d{3}\z/ ? '' : '_001');

The PerlMonk tr/// Advocate