Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!phillips From: phillips@cs.ubc.ca (George Phillips) Newsgroups: comp.lang.perl Subject: Re: Counting RE occurrences Summary: perl == APL++? Keywords: regexps, /g, /n, split, arrays, APL, invert Message-ID: <1991May21.075323.24778@cs.ubc.ca> Date: 21 May 91 07:53:23 GMT References: <1991May13.225603.29819@convex.com> <1991May16.010149.20536@uunet.uu.net> <1991May17.132403.12104@convex.com> Sender: usenet@cs.ubc.ca (Usenet News) Organization: University of British Columbia, Vancouver, B.C., Canada Lines: 32 In article <1991May17.132403.12104@convex.com> tchrist@convex.COM (Tom Christiansen) writes: >From the keyboard of rbj@uunet.uu.net (Root Boy Jim): >:>I know, I know... along that road lies APL and madness. >: >:Too late. Perl is already weirder than APL. Uglier too. > >Oh good, does that mean we'll get > > @a += @b; > @c = @a + @b; > >one of these days then? :-) Nah, too conventional. Go for an extension to the array to associative array assignment. We can already do this: %a = ("bip", "bop", "boop", "beep" ); So why not: %a .= ("more", "less", "more", "even less" ); Which should give $a{"more"} eq "lesseven less". Now round it out to support "+=", "*=" and all the other op assignment operators. Not only would this be cute, but it could save as much as 3 lines of code in every hundredth perl script you write. %p .= (Just," another ",Just,Perl,Just," hacker,");print %p."\n"; -- George Phillips phillips@cs.ubc.ca {alberta,uw-beaver,uunet}!ubc-cs!phillips