Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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 examining the Monastery: (4)
As of 2015-11-25 09:41 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (672 votes), past polls