Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

torf or Mindy?

by metaperl (Curate)
on Apr 29, 2009 at 15:11 UTC ( #760901=snippet: print w/ replies, xml ) Need Help??

Description: Well, oftentimes when pulling data from somewhere, you will need to humanize booleans... not everyone is a Mork from Ork!
sub torf {
    my($val, $true_word, $false_word)=@_;

    $true_word  ||= 'Yes' ;
    $false_word ||= 'No' ;

    $val ? $true_word : $false_word ;
}
Comment on torf or Mindy?
Download Code
Reaped: Re: torf or Mindy?
by NodeReaper (Curate) on Jun 18, 2010 at 23:38 UTC

Back to Snippets Section

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2015-06-03 11:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What kind of chocolate gives you the most pleasure?















    Results (129 votes), past polls