AITHA, BHEEMSEN (SBCSI) wrote: > 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.
Something like this should work: my @f = split /\|/, $line; my $date = sprintf "%02u/%02u/%04u", substr ($f[2], 2, 2), substr ($f[2], 4, 2), substr ($f[2], 0, 2) + 2000; And get rid of those extra addresses in your post - esp the one to wgn.net which I haven't used in years. _______________________________________________ Perl-Unix-Users mailing list Perl-Unix-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs