Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: defined and value is 0

by Athanasius (Archbishop)
on Jul 06, 2020 at 14:14 UTC ( [id://11118971]=note: print w/replies, xml ) Need Help??


in reply to defined and value is 0

Hello redtux,

This line:

if (!(defined $opt,$hash{$file}->{$opt})){

is probably not doing what you expect. From Comma Operator:

Binary "," is the comma operator. In scalar context it evaluates its left argument, throws that value away, then evaluates its right argument and returns that value. This is just like C's comma operator.

As hippo has shown, you want a logical AND (i.e., &&) here rather than a comma.

Hope that helps,

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

Replies are listed 'Best First'.
Re^2: defined and value is 0
by redtux (Sexton) on Jul 06, 2020 at 15:37 UTC
    Many apologies, I noticed that just before you posted. Removed the key ($opts) and everything works right

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-25 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found