Thanks for the help, I think this will work out.
oh. Unusual site you have there.
-----Original Message-----
From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 11:03 AM
To: Derrick (Thrawn01)
Cc: Perl Beginners
Subject: Re: printf to convert 200010809 to 2001-08-09
On Mon, 10 Sep 2001, Derrick (Thrawn01) wrote:
> @data[0]->[17] contains "20010809"
>
> I've been tring to use printf to convert the 200010809 value out as
> 2001-09-08
>
> $last_open = sprintf "%4d-%2d-%2d",@data[0]->[17];
>
> However this does not work. I get "20010809- 0- 0"
> Any sugesstions on how I should make this converstion with out adding alot
> of overhead doing it ?
Use a regular expression. printf isn't useable for what you are trying to
do:
my $data = 20010809;
$data =~ /(\d{1,4})(\d{1,2})(\d{1,2})/;
print "$1-$2-$3\n";
This prints:
2001-08-09
-- Brett
http://www.chapelperilous.net/
------------------------------------------------------------------------
All articles that coruscate with resplendence are not truly auriferous.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]