Rick Klement wrote:
> 
> Brian Morgan wrote:
> >
> > ($Yr = $FieldA) =~ s/^(\d{2}).*/$1/;
> > if($Yr > 20){
> >     $Yr = "19$Yr";
> > }else{
> >     $Yr = "20$Yr";
> > }
> >
> > #Concat year to FieldB
> 
> There is no need for a regex
> 
>         $Yr = ($FieldA > 20 ? 1900 : 2000) + $FieldA;
> 
> Or just get $FieldB directly if you don't need a separate $Yr
> 
>         $FieldB = ($FieldA < 21) + 19 . $FieldA;
> 
> --
> Rick Klement

Another "straight to FieldB" given that the year range is only 1970 to 2004

        $FieldB = 19 + $FieldA=~/^0/ . $FieldA;

-- 
Rick Klement

Reply via email to