Re: Y2K Again ??
"A. Pagaltzis" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <20040514140347.GB810@klangraum> |
* Brian Morgan <[email protected]> [2004-05-14 13:19]: > ($Yr = $FieldA) =~ s/^(\d{2}).*/$1/; > if($Yr > 20){ > $Yr = "19$Yr"; > }else{ > $Yr = "20$Yr"; > } It isn't exactly to your specs (equates to checking $Yr > 19), but could be made to, at the expense of much more complicated patterns. $year = $FieldA =~ /^([0-1]\d)/ ? 2000 + $1 : $FieldA =~ /^([2-9]\d)/ ? 1900 + $1 : die "Expected two digits at start of '$FieldA'"; -- Regards, Aristotle "If you can't laugh at yourself, you don't take life seriously enough."