in reply to Dynamically changing the value of a passed variable into a sub
I have also added the $ and ^ to the regex so as to make sure something like $date_created=SA123454 does not match. But just because it is an 8 digit number does not mean that it is a date, so other checks might be necassary as well.unless ($date_created =~ s!^(\d{4})(\d{2})(\d{2})$!$2/$3/$1!) { warn " +Invalid Input: $date_created" }
Update: I think I misunderstood the question and thus think gjb has the answer you are looking for above.
-enlil
|
|---|