perl.beginners
[Top] [All Lists]

Re: commify_series script in cookbook page 94

Subject: Re: commify_series script in cookbook page 94
From: Richard Lee
Date: Sun, 30 Mar 2008 20:36:42 -0400
Newsgroups: perl.beginners


Dr.Ruud wrote:
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.

I understood the original but I am not so sure of your solution??

Can you write it out completely so that I can try it out?

thanks.

<Prev in Thread] Current Thread [Next in Thread>