Derrick schrieb:
> 
> @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 ?

sprintf wants to print 3 numbers %4d, %2d and %2d.
sprintf expects them as 3 (!!) arguments, like sprintf
"%4d-%2d-%2d",2001,08,09;
but it receives something like sprintf "...",20010809,undef,undef.

You should use a RE to get the three different numbers:

sprintf "%4d-%2d-%2d", @data[0]-[17] =~ / (\d\d\d\d) (\d\d) (\d\d) /x;

Best Wishes,
Andrea

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

Reply via email to