Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!decwrl!orc!mipos3!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: length operator Keywords: quibble Message-ID: <1990Feb15.230159.8255@iwarp.intel.com> Date: 15 Feb 90 23:01:59 GMT References: <13103@cgl.ucsf.EDU> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Distribution: comp Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 29 In-Reply-To: pett@cgl.ucsf.edu (Eric Pettersen) In article <13103@cgl.ucsf.EDU>, pett@cgl (Eric Pettersen) writes: | | IMHO, the "length" operator should not allow the "length EXPR" syntax. | I often want to handle "length-2" which, because the above syntax is legal, | forces me to write "length($_) - 2" instead. Not to mention causing me some | lost time while trying to figure out why "length-2" doesn't work. This has | probably caught other people as well. Does "length EXPR" have any supporters? $_ = "a long string"; $len = (length)-2; print "the length is $len\n"; $len = length()-2; print "the length is still $len\n"; prints: the length is 11 the length is still 11 Okay, so it is still a bit icky. Being able to type "length > 128" (a good thing) means having that silly optional EXPR stuff (a bad thing). Maybe there's an alternate, but it won't make it into patch 9. :-) $_="Just another Perl hacker,";for$i(1..length){print substr($_,$i-1,1);} -- /=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: "Welcome to Portland, Oregon, home of the California Raisins!"=/