Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

converting from switch to given-when

by jmlynesjr (Hermit)
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?

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
[stonecolddevin]: hey MidLifeXis, all
[MidLifeXis]: o/
[GotToBTru]: greets

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2017-01-20 19:20 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (176 votes). Check out past polls.