You could try something like this:

$data = '760434|c|061230';
($date) = $data =~ m/^.\|(\d+)/;
$date =~ s%(\d\d)(\d\d)(\d\d)%$2/$3/20$1%;

Matt

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
AITHA, BHEEMSEN (SBCSI)
Sent: Friday, January 05, 2007 11:57 AM
To: $Bill Luebkert; [EMAIL PROTECTED];
perl-unix-users@listserv.ActiveState.com
Subject: [Perl-unix-users] How to parse a date string and convert it
intomm/dd/yyyy format

Hi,

I have a file with the following as the first line.

760434|c|061230

I need to parse this line and read 061230 into a variable and then try
to convert that string into the date in format mm/dd/yyyy. Report any
error while converting the string.

Any sample code would be a great help.

I do not want to use Date::Manip module.

Thanks for any help.
-Bheem
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to