Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

converting from switch to given-when

by jmlynesjr (Friar)
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
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2015-08-30 08:14 GMT
Find Nodes?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...

    Results (348 votes), past polls