Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: How to get 0 to initialize a value

by Fletch (Bishop)
on May 01, 2019 at 14:19 UTC ( [id://1233230]=note: print w/replies, xml ) Need Help??


in reply to Re: How to get 0 to initialize a value
in thread How to get 0 to initialize a value

Perl Best Practices (chapter 6; don't have dead tree version handy so no clue on a page number) recommends laying chained ternary expressions out as a table. If you squint it almost looks haskelly.

# Name format... # Salutation... my $salute = $name eq $EMPTY_STR ? 'Dear Custome +r' : $name =~ m/ \A((?:Sir|Dame) \s+ \S+) /xms ? "Dear $1" : $name =~ m/ (.*), \s+ Ph[.]?D \z /xms ? "Dear Dr $1" : "Dear $name" + ;

The cake is a lie.
The cake is a lie.
The cake is a lie.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (None)
    As of 2024-04-25 00:02 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found