Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: quasi-bug Message-ID: <1990Mar28.213544.23723@iwarp.intel.com> Date: 28 Mar 90 21:35:44 GMT References: <1121@etnibsd.UUCP> <15290@bfmny0.UU.NET> <1990Mar28.180657.22785@iwarp.intel.com> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 32 In-Reply-To: flee@shire.cs.psu.edu (Felix Lee) In article , flee@shire (Felix Lee) writes: | Randal L. Schwartz wrote: | > while ($_ = shift) { | > &expression(length ? $_ : shift), next if s/^-e//; | > &file(length ? $_ : shift), next if s/^-f//; | > # ... | > } | | Okay. That looks pretty usable, if still somewhat frightening. I'll | have to remember to use "length" rather than testing strings directly. | Note, the while loop should read: | while (length($_ = shift)) | to handle "0" arguments properly... [See my other posting for a bug fix to the included code.] The while loop should read instead: while (@ARGV) { $_ = shift; ... ... } to handle zero-length arguments, if you're gonna get picky. :-) ($_="Just another Perl hacker,"); 0 while s#.# do {print $&;} #e,s/^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!"=/