Re: commify_series script in cookbook page 94



Richard Lee schreef:

While reading perl cookbook, I came to page 94 and having a hard time
understanding this particular phrase

my $sepchar = grep( /,/ => @_ ) ? ";" : ",";

Shortcutting alternative:

my $sepchar = ",";
for (@_) { /,/ and $sepchar = ";" and last }

but (unless @_ is quite big) the grep alternative is likely to be
faster.

--
Affijn, Ruud

"Gewoon is een tijger."

.



Relevant Pages

  • Re: Speed limit at C a misconception?
    ... > My understanding of the phrase "nothing can go faster than light" ... then the phrase "nothing can go faster than light ... information, energy, momentum, and angular momentum "material objects". ...
    (sci.optics)
  • Re: Shortage of sperm donors
    ... Nobby, you mean? ... But he's away with the camels again, ... Is there a clear understanding of what, exactly, this phrase means? ...
    (uk.media.radio.archers)
  • Re: Reactions to/against the Binary Tree
    ... one would have to conclude that this person is nuts. ... This is utter nonsense with the common understanding of the phrase "every ... understanding will he have about infinite sets, ...
    (sci.logic)
  • Re: Fortran is the word an acronym or a portmanteau?
    ... using initial letters from words in a phrase. ... My understanding has always been that it is RAdio Detection And Ranging. ...
    (comp.lang.fortran)
  • Re: best method to perform operations on word lists
    ... because the regex matches the empty string as well. ... "Gewoon is een tijger." ...
    (comp.lang.perl.misc)