Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Deferring variables

by Athanasius (Archbishop)
on Jun 25, 2022 at 14:24 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-20 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found