----- Original Message ----- 
From: "Pablo Fischer" <[EMAIL PROTECTED]>
To: "Perl Beginners" <[EMAIL PROTECTED]>
Sent: Saturday, July 26, 2003 1:35 PM
Subject: Case Statement


> Hello Again!
>
> I need to evaluate a lot of conditionals, and of course the use of a lot
of
> if's its not the 'right' way, so Im using something like this:
>
> CASE: {
> ($string == "match1") && do {
> actions..
> last CASE;
> };
> ($string == "match2") && do {
> actions..
> last CASE;
> };
> and a lot more..
> }
>
> The question, where does the 'default' case starts?. The last 5 years I
have
> been programming in C/C++/C#/Php.. C-styles languages, so in Perl, where
does
> the 'default' case begins?
>
> Thanks
> Pablo
> -- 

Pabalo -

The 'default' sarts after your last 'do', where
you have 'and a lot more...' above. Also, you
should use 'eq' NOT '==' for alphanumeric
compares:

 ($string eq 'whatever') && do {
   ...
  };

You may want to put your test staing in $_ and
use regexs:

$_ = $string;
CASE: {
 /match 1/ && do {
  ...
 }:
 ...
}

Aloha => Beau;
== please visit ==
<http://beaucox.com> => main site
<http://howtos.beaucox.com> => howtos
<http://PPM.beaucox.com> => perl PPMs
<http://CPAN.beaucox.com> => CPAN
== thank you ==



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to