Prev: Thank you Rakudo-Star (and question about SciTE for Perl 6)
Next: Can this be done (by a noob :))
From: John Kelly on 2 Aug 2010 12:24 On Mon, 2 Aug 2010 17:14:06 +0200, "Peter J. Holzer" <hjp-usenet2(a)hjp.at> wrote: >On 2010-08-02 11:32, Randal L. Schwartz <merlyn(a)stonehenge.com> wrote: >>>>>>> "Ben" == Ben Morrow <ben(a)morrow.me.uk> writes: >> >>Ben> Um, what exactly is wrong with >> >>Ben> perl -e 'system "/bin/sh", -c => "eval ls /"' >> >> 1) complexity > >It looks more complex than > > system "eval ls /;" > >but it really isn't and that ";" is really easy to miss. That's why I suggested: system ":; eval ls /" It's easy miss ";" at the end, but hard to miss ":;" at the beginning. >So that would have to be something like > > system "eval ls /;"; # ; forces shell > >and then you can write > > system "/bin/sh", "-c", "eval ls /" > >too. It even saves two characters ;-). I like mine best. :-) -- Web mail, POP3, and SMTP http://www.beewyz.com/freeaccounts.php
From: Ben Morrow on 2 Aug 2010 12:20 Quoth merlyn(a)stonehenge.com (Randal L. Schwartz): > >>>>> "Ben" == Ben Morrow <ben(a)morrow.me.uk> writes: > > Ben> Um, what exactly is wrong with > > Ben> perl -e 'system "/bin/sh", -c => "eval ls /"' > > 2) using => as a bizarro-world comma > > Please. Don't. A certain individual started that, and like JAPHs, it's > a meme that deserves to die. => *is* a bizarro-world comma. That is its sole function. I tend to use it in all circumstances where I am listing (name, value) pairs; since -c takes a single argument I see it as the key of such a pair. Ben
From: Ilya Zakharevich on 2 Aug 2010 17:12 On 2010-08-02, Randal L. Schwartz <merlyn(a)stonehenge.com> wrote: >Ben> perl -e 'system "/bin/sh", -c => "eval ls /"' > 1) complexity > 2) using => as a bizarro-world comma > Please. Don't. A certain individual started that, and like JAPHs, it's > a meme that deserves to die. [I presume (by proximity of JAPH) that this "certain individual" is you (no, I would not remember myself). I think there is nothing to be shameful about for this meme.] When in "random position" in a list, => MAY be confusing. On the other hand, it may be a tool to attract attention to most important element(s) of the list. When used between two "logically connected" parts of the list (as in $^X, -I => $INC, ...), it is, IMO, very appropriate. Yours, Ilya
From: C.DeRykus on 2 Aug 2010 22:33 On Aug 2, 2:12 pm, Ilya Zakharevich <nospam-ab...(a)ilyaz.org> wrote: > On 2010-08-02, Randal L. Schwartz <mer...(a)stonehenge.com> wrote: > > >Ben> perl -e 'system "/bin/sh", -c => "eval ls /"' > > 1) complexity > > 2) using => as a bizarro-world comma > > Please. Don't. A certain individual started that, and like JAPHs, it's > > a meme that deserves to die. > > ... > When in "random position" in a list, => MAY be confusing. On the > other hand, it may be a tool to attract attention to most important > element(s) of the list. > > When used between two "logically connected" parts of the list (as in > $^X, -I => $INC, ...), it is, IMO, very appropriate. > some non-word cautions for the unwary: perl -wle ' %h =( 12:00 => "lunch")' syntax error at ... near "12:" perl -MO=Deparse -wle ' x( area-54 => 'verboten' );' Unquoted string "area" may clash ... x('area' - 54, 'verboten'); -e syntax OK -- Charles DeRykus Charles DeRykus
From: Uri Guttman on 2 Aug 2010 23:07
>>>>> "CD" == C DeRykus <derykus(a)gmail.com> writes: CD> On Aug 2, 2:12�pm, Ilya Zakharevich <nospam-ab...(a)ilyaz.org> wrote: >> When in "random position" in a list, => MAY be confusing. �On the >> other hand, it may be a tool to attract attention to most important >> element(s) of the list. >> >> When used between two "logically connected" parts of the list (as in >> $^X, -I => $INC, ...), it is, IMO, very appropriate. CD> some non-word cautions for the unwary: CD> perl -wle ' %h =( 12:00 => "lunch")' CD> syntax error at ... near "12:" CD> perl -MO=Deparse -wle ' x( area-54 => 'verboten' );' CD> Unquoted string "area" may clash ... CD> x('area' - 54, 'verboten'); CD> -e syntax OK well the docs say => quotes perl word (also words starting with -) to its left and those aren't perl words. i don't use => except for real pairs in hashes or arrays (that will eventually be copied to hashes). i also find the cute style of using it with some args to be wrong. uri -- Uri Guttman ------ uri(a)stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- |