Re: Y2K Again ??

Uri Guttman <[email protected]>
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
>>>>> "BM" == Brian Morgan <[email protected]> writes:

  BM> ($Yr = $FieldA) =~ s/^(\d{2}).*/$1/;

  BM> if($Yr > 20){
  BM>     $Yr = "19$Yr";
  BM> }else{
  BM>     $Yr = "20$Yr";
  BM> }

  BM> I guess I am looking for a way to combine a substitution with the if
  BM> statement but haven't come up with a working solution.

	($Yr = $FieldA) =~ s/^(\d{2}).*/$1 > 20 ? "19$1" : "20$1"/e;

but i am not a fan of the assign and modify in one style

	$Yr = $FieldA =~ /^(\d{2})/ && $1 > 20 ? "19$1" : "20$1" ;

and studly caps ain't good perl style.

uri

-- 
Uri Guttman  ------  [email protected]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.