Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Trying to compare a string...

by tobyink (Abbot)
on Oct 18, 2013 at 10:43 UTC ( #1058741=note: print w/ replies, xml ) Need Help??


in reply to Trying to compare a string...

There's already been some good answers, but just in the interests of pimping...

use v5.14; use Switcheroo; my @genres = ('War', 'Death'); my $genre = switch ($genres[0]) do { case "Science Fiction", "Sci-Fi", "Fantasy": "Sci-Fi & Fantasy"; case "Action", "Adventure", "War": "Action & Adventure"; case "Kids", "Family": "Kids & Family"; default: $_; }; say $genre; # Action & Adventure
use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name


Comment on Re: Trying to compare a string...
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1058741]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2014-12-27 10:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls