[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] testing



>From: Ken Williams <ken@forum.swarthmore.edu>

> And what "switch" construct is that?  There is none in Perl.

Hi Guys,

While I am not speaking for Arved, (he know a whole lot more about Perl than
I do), I suspect this is what he was talking about.

>From the Camel Book, page 104,

SWITCH: {
    if (/^abc) { $abc =1; last SWITCH;}
    if (/^def) { $def =1; last SWITCH;}
    if (/^xyz) { $xyz =1; last SWITCH;}
    $nothing = 1;
}

Or maybe this version,

SWITCH: {
    $abc = 1, last SWITCH if /^abc/;
    $def = 1, last SWITCH if /^def/;
    $xyz = 1, last SWITCH if /^xyz/;
    $nothing = 1;
}

There are four other examples listed. I agree with Arved on one point. Keep
it simple and straightforward. Reading code 6 months later can be a little
embarrassing with some of Perl's more unique constructs.

Elton

=========================================================================
NOVA Private Industry Council                 505 W. Olive Ave. Suite 550
Elton Hughes (Information Technology)                  Sunnyvale CA 94086
Phone: 408-730-7235                                     Fax: 408-730-7643
-------------------------------------------------------------------------


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org