in reply to Variable assignment confusion

You need to enclose the regex match you're looking for in parentheses to assign it to a variable that way. For example:

my ($new_retid) = $retid =~ /(^\d{4}_\d{3})$/; $new_retid ||= $retid.'_001';

Replies are listed 'Best First'.
Re: Re: Variable assignment confusion
by sweetblood (Prior) on Dec 15, 2003 at 19:06 UTC
    This is very clever. It's not what I had been thinking of but would work nicely.

    Thanks!