Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Not getting desire output by using switch statement in Perl

by choroba (Abbot)
on Jan 06, 2014 at 22:16 UTC ( #1069590=note: print w/ replies, xml ) Need Help??


in reply to Re: Not getting desire output by using switch statement in Perl
in thread Not getting desire output by using switch statement in Perl

You can use the ternanry operator to save you typing print twice:

print exists $a{$_} ? $a{$_} : 'Everything else', "\n";

This is how I use the ?:.

لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re^2: Not getting desire output by using switch statement in Perl
Download Code
Re^3: Not getting desire output by using switch statement in Perl
by Lennotoecom (Pilgrim) on Jan 06, 2014 at 22:27 UTC
    awesome, thank you

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2014-09-20 01:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (151 votes), past polls