Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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?
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?
[Your Mother]: I like Manu Chao.
[Your Mother]: I like this one quite well, https://www. youtube.com/watch? v=rSEUH4KRfN8
[choroba]: Půlnoční Marie (which means Midnight Mary)
[choroba]: but the band is practically dead. We rehearse once in a year, and perform with the same frequency
[ambrus]: `quote
[ambrus]: sorry, typed in the wrong box
[LanX]: Your mother: je ne t'aime plus! ;)
[choroba]: seems lispy
[Your Mother]: Be nice! I speak that much French. Though I also like that song.
[choroba]: So, I joined Pod Černý Vrch some months ago to still have the fun. But I wouldn't call it "punk" anymore...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (14)
As of 2017-03-24 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (301 votes). Check out past polls.