Interesting question. Took me a lot longer than I expected. Did you know you can have perl statements inside your regex?
#!/usr/bin/perl for (@ARGV) { my $d; s! (\d{2})/ (\d{2})/ (\d{2}) (?{ $d = ($3 gt 55)?'19'.$3:'20'.$3;}) !$d/$1/$2!ox; print; print "\n"; }
%./foo 01/02/03 02/14/08 01/02/89 2003/01/02 2008/02/14 1989/01/02
In reply to Re: Combining s///
by starbolin
in thread Combining s///
by kangaroobin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |