in reply to A quick date swap from a string

Your variable scope looks wrong to me. You declare $date at the top of the routine, then try and declare it again a little bit later (in the same context). Finally you declare a 3rd time in the foreach routine.

Drop the second "my $date;", and remove the "my" keyword on the substitution line in the foreach loop.

Replies are listed 'Best First'.
Re^2: A quick date swap from a string
by shawnhcorey (Friar) on Jul 09, 2009 at 04:14 UTC
    Change the substitute to:
         $date =~ s/$strBegin/$months{uc $strBegin}/e;
    
    The function uc() will not be executed otherwise.