Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
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 lurking in the Monastery: (13)
As of 2014-10-21 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (106 votes), past polls