On Mon, 10 Sep 2001, Derrick (Thrawn01) wrote:
> Now that I think about it it could be done like this
>
> @tary = unpack "a4a2a2", @data[0]->[17];
> $last_open = "$tary[0]-$tary[1]-$tary[2]";
>
> But wich would be faster ? would unpack be faster than the exp engine?
>
> Anyone's thoughts ?
I bet
> "Derrick" == Derrick <[EMAIL PROTECTED]> writes:
Derrick> Now that I think about it it could be done like this
Derrick> @tary = unpack "a4a2a2", @data[0]->[17];
Can we please stop using the illegal syntax there?
$data[0][17] or $data[0]->[17] or ${$data[0]}[17], but not @data[0]->...
Th
rett 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
Either of these will work -- I'll leave it up to the experts to let us know
which one (if any) is faster or more efficient:
$last_open = sprintf '%04d-%02d-%02d', $data[0]->[17] =~
/^(\d{4})(\d{2})(\d{2})$/;
$last_open = sprintf '%04d-%02d-%02d', unpack 'A4A2A2', $data[0]->[17];
Please note tha
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
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
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
make your %4d-%2d-%2d look like %4d-%02d-%02dThe zero with the number says
to have zero fill instead of blank fill.
Wags ;)
-Original Message-
From: Derrick (Thrawn01) [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 07:57
To: Perl Beginners
Subject: printf to con