>Is there a correct way to define a default case within a SWITCH? I tried
with
>the bottom case, but that errors with:
>Quantifier follows nothing before HERE mark in regex m/* << HERE / at
./ctest line 251.

>SWITCH:
>{
>   $field =~ /^CR\d{0,7}$/ && do
>        {
>          $openCRs++;
>          print "<td><a href=\"/cgi-bin/ctest?repOn=CR&crNumber
=$field\">$field</a></td>";
>          last SWITCH;
>        };
>   $field eq $engineer && do
>        {
>          print "<td><a href=/cgi-bin/ckEng?$field>$field</a></td>";
>          last SWITCH;
>        };
>   $field =~ /*/ && do
>        {
>          print "<td>$field</td>";
>          last SWITCH;
>        };
>}
>
>I want to match anything else including an empty field with the last case.
Your help
>is greatly appreciated, thanks.

Not to confuse you, but there is no such thing as a SWITCH statment in
Perl.  Above you have defined a tag to name a block and then set up
conditions that if true, runs the code in the do block and exit the SWITCH:
block.  You could have substituted any tag for SWITCH, though SWITCH does
clarify what you're doing.

So any code you place after the last do block will execute if there is no
match.  Actually, to draw on your above style, I think '$field =~ /.*/'
should match on anything.

Enjoy,
Peter







****** CONFIDENTIALITY NOTICE ******
NOTICE:  This e-mail message and all attachments transmitted with it may 
contain legally privileged and confidential information intended solely for the 
use of the addressee.  If the reader of this message is not the intended 
recipient, you are hereby notified that any reading,
dissemination, distribution, copying, or other use of this message or its
attachments is strictly prohibited.  If you have received this message in
error, please notify the sender immediately and delete this message from your 
system.  Thank you..



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to