| Subject: | Re: commify_series script in cookbook page 94 |
|---|---|
| From: | Dr.Ruud |
| Date: | Mon, 31 Mar 2008 02:02:36 +0200 |
| Newsgroups: | perl.beginners |
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."
|
| Previous by Date: | Re: sort without ignoring hyphens, tc314 |
|---|---|
| Next by Date: | Re: commify_series script in cookbook page 94, Richard Lee |
| Previous by Thread: | Re: commify_series script in cookbook page 94, Richard Lee |
| Next by Thread: | Re: commify_series script in cookbook page 94, Richard Lee |
| Indexes: | [Date] [Thread] [Top] [All Lists] |