Almost... This works: ($date) = $data =~ m/^.+\|(\d+)/;
Then as below. It needs the '+'. Deane Rothenmaier Systems Architect Walgreens Corp. 847-914-5150 "Science is not only compatible with spirituality; it is a profound source of spirituality." -- Carl Sagan "Matt Schneider" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 01/05/2007 02:19 PM To: "AITHA, BHEEMSEN (SBCSI)" <[EMAIL PROTECTED]>, "$Bill Luebkert" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>, <perl-unix-users@listserv.ActiveState.com> cc: Subject: Re: [Perl-unix-users] How to parse a date string and convert it intomm/dd/yyyy format 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
_______________________________________________ Perl-Unix-Users mailing list Perl-Unix-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs