> > 2- Want to format dates like birth = 02151956 should be 02/15/1956
> my $date = "$1/$2/$3/" if (/(\d\d)(\d\d)(\d\d\d\d)/)

# All of this is UNTESTED, please treat as such.

# More of "the same but different"

   my $date = qq($1/$2/$3) if /(\d{2})(\d{2})(\d{4})/;

# Takes into account dates like 07/03/2003, unless
# of course you've lopped off the preceding "000" type
# strings with s/^0+//;  --- for example:

   my $in = '000007032003';
   my $out = qq($1/$2/$3) if /(\d{2})(\d{2})(\d{4})/;
   print $out;

# would result in printing:
# 00/00/0703

# This might work better (preserving preceding "0" on the date)

   my $in = '000007032003';
   $in =~ s/^0+/$1/ if (/(\d{2})(\d{2})(\d{4})$/);
   my $out = qq($in/$2/$3);


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to