Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2016-02-14 18:04 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (470 votes), past polls