Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Deferring variables

by Athanasius (Archbishop)
on Jun 25, 2022 at 14:24 UTC ( #11145038=note: print w/replies, xml ) Need Help??


in reply to Deferring variables

Hello Chuma,

A quick observation: if you change the “unspecified” value from 'a' to undef, you can simplify this:

if($par{'margin-left'} ne 'a'){ $actual = $par{'margin-left'} }elsif($par{'margin-horizontal'} ne 'a'){ $actual = $par{'margin-horizontal'} } else{$actual = $par{'margin'}}

to this:

$actual = $par{'margin-left'} // $par{'margin-horizontal'} // $par{'ma +rgin'};

which is easier to comprehend as well as to type. See Logical Defined Or.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2022-12-06 19:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?