From owner-freebsd-hackers Wed Nov 29 05:31:18 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id FAA14935 for hackers-outgoing; Wed, 29 Nov 1995 05:31:18 -0800 Received: from public.wintek.com (public.wintek.com [199.233.104.88]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id FAA14927 ; Wed, 29 Nov 1995 05:31:16 -0800 Received: from watson.grauel.com (watson.grauel.com [199.233.104.36]) by public.wintek.com (8.6.12/1.07wintek(3.6davy)) with ESMTP id IAA04363; Wed, 29 Nov 1995 08:30:44 -0500 Received: from sparcmill.grauel.com (sparcmill [199.233.104.34]) by watson.grauel.com (8.6.11/8.6.9) with SMTP id IAA14963; Wed, 29 Nov 1995 08:42:55 -0500 Received: by sparcmill.grauel.com (5.0/SMI-SVR4) id AA05867; Wed, 29 Nov 1995 08:25:29 +0500 Date: Wed, 29 Nov 1995 08:25:29 +0500 Message-Id: <9511291325.AA05867@sparcmill.grauel.com> From: Richard J Kuhns To: "Jordan K. Hubbard" Cc: hackers@freefall.freebsd.org Subject: Bug in stable/-current perl? In-Reply-To: <199511290543.VAA13120@freefall.freebsd.org> References: <199511290543.VAA13120@freefall.freebsd.org> content-length: 914 Sender: owner-hackers@FreeBSD.ORG Precedence: bulk Jordan K. Hubbard writes: > jkh@freefall-> date > Tue Nov 28 21:42:48 PST 1995 > > jkh@freefall-> perl -e 'printf("%02.2d\n", (localtime())[3]);' > 28 > jkh@freefall-> perl -e 'printf("%02.2d\n", (localtime())[4]);' > 10 > jkh@freefall-> perl -e 'printf("%02.2d\n", (localtime())[5]);' > 95 > > 10? Am I misunderstanding something fundamental about perl's > localtime() call, or should this be an "11"? > > Jordan > >From `Programming Perl', page 157, referring to the return value of localtime(): "All array elements are numeric, and come straight out of a struct tm. [...] In particular this means that [the month value] has the range 0..11". I think the idea is that you can use month value as a zero-based array subscript to go from number to name. Day of week is done the same way. -- Rich Kuhns rjk@grauel.com PO Box 6249 100 Sawmill Road Lafayette, IN 47903 (317)477-6000 x319