Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal L. Schwartz) Newsgroups: comp.lang.perl Subject: Re: perl 4.0 patch #1 Message-ID: <1991Apr25.200734.17731@iwarp.intel.com> Date: 25 Apr 91 20:07:34 GMT References: <1991Apr18.000041.16584@sics.se> <550@appserv.Eng.Sun.COM> <3012@weber.sw.mcc.com> <18285@sunquest.UUCP> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal L. Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 32 In-Reply-To: jew@rt.uucp (/87336) In article <18285@sunquest.UUCP>, jew@rt (/87336) writes: | | In the process of learning perl, I have translated an awk script I wrote. | I figured there is a better way to do this: | | # define an array of months | $Calendar{'Jan'} = '01'; | $Calendar{'Feb'} = '02'; | $Calendar{'Mar'} = '03'; | $Calendar{'Apr'} = '04'; | $Calendar{'May'} = '05'; | $Calendar{'Jun'} = '06'; | $Calendar{'Jul'} = '07'; | $Calendar{'Aug'} = '08'; | $Calendar{'Sep'} = '09'; | $Calendar{'Oct'} = '10'; | $Calendar{'Nov'} = '11'; | $Calendar{'Dec'} = '12'; | | Here's your chance to show your elegance! What's the best way to define | this array? @Calendar{Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec} = '01'..'12'; (Did anyone doubt I could do it in one line? :-) print "$ARGV[@ARGV = ('Just another Perl hacker,'), 0]" -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/