Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

converting from switch to given-when

by jmlynesjr (Pilgrim)
on Sep 25, 2012 at 01:29 UTC ( #995476=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use switch;
    switch ($selection) {
                case wxID_YES      {$self->Wx::LogStatus ("You pressed:  \
    +"Yes\" ")}
                case wxID_NO      {$self->Wx::LogStatus ("You pressed:  \"
    +No\" ")}
                case wxID_CANCEL  {$self->Wx::LogStatus ("You pressed:  \"
    +Cancel\" ")}            
        }
    
  2. or download this
    given ($selection) {
                when (wxID_YES)      {$self->Wx::LogStatus ("You pressed: 
    + \"Yes\" ")}
                when (wxID_NO)      {$self->Wx::LogStatus ("You pressed:  
    +\"No\" ")}
                when (wxID_CANCEL)  {$self->Wx::LogStatus ("You pressed:  
    +\"Cancel\" ")}            
        }
    
  3. or download this
    given ($selection) {
                when ($_ == wxID_YES)      {$self->Wx::LogStatus ("You pre
    +ssed:  \"Yes\" ")}
                when ($_ == wxID_NO)      {$self->Wx::LogStatus ("You pres
    +sed:  \"No\" ")}
                when ($_ == wxID_CANCEL)  {$self->Wx::LogStatus ("You pres
    +sed:  \"Cancel\" ")}            
        }
    
  4. or download this
    my $yes = wxID_YES;
    when ($yes)   {....}
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://995476]
Approved by Athanasius
Front-paged by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2014-09-19 17:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (143 votes), past polls