Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!mips!apple!oliveb!orc!mipos3!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: Are only simple scalars allowed in "do SUBROUTINE (LIST)" ? Message-ID: <1990Mar7.181226.3626@iwarp.intel.com> Date: 7 Mar 90 18:12:26 GMT References: <1211@frankland-river.aaii.oz.au> <7269@jpl-devvax.JPL.NASA.GOV> <21611@watdragon.waterloo.edu> <1990Mar6.180823.27618@iwarp.intel.com> <7294@jpl-devvax.JPL.NASA.GOV> <15236@bfmny0.UU.NET> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 34 In-Reply-To: tneff@bfmny0.UU.NET (Tom Neff) In article <15236@bfmny0.UU.NET>, tneff@bfmny0 (Tom Neff) writes: | In article <7294@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: | >Would you settle for this? | > | > ( LIST ) [ EXPR ] | | Definitely, absolutely, this would be great!! | | Slicing self-defining lists would be a subtle and powerful technique if | implemented. And it's an elegant fit in the Perl model. Yeah, and don't forget (since *I* forgot it :-), ( LIST ) { EXPR } for an assoc-array! (Now, how's *that* for weird??!!) Usage like: print ('r','red','b','blue','g','green'){$color}, " was picked.\n"; OK, so I'm a fanatic for orthogonality. I dare'ya to parse that cleanly. Will it work inside quoted strings? :-) :-) [I confess: I worked on the following sig ahead of time...] open(M,"/usr/games/lib/quiz.k/morse") || die "morse: ($!)"; while() {next unless /([A-Z]):(.*)/; $m{$2}=$1;} close(M); print grep($_ = ($m{$_} || $_), split(/([^-.])/,<