Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: open failure code

by Revelation (Deacon)
on Nov 26, 2003 at 23:17 UTC ( #310409=note: print w/replies, xml ) Need Help??


in reply to open failure code

It's all about operator precedence. For more information about precedence theory checkout perlop.
Regarding your specific problem:
The line  open ($fh,$log) || $down = 'moo'
is evaluated as (open ($fh,$log) || $down) = 'moo';
Obviously, open isn't an lvalue function; you can't assign it a value.
$log = "moooojlfdkafj.txt"; $down="false"; open (FH, $log) || ( $down = "true" ); print $down;
or
$log = "moooojlfdkafj.txt"; $down="false"; open (FH, $log) or $down = "true"; print $down;
work.

Gyan Kapur

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2018-10-19 09:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (107 votes). Check out past polls.

    Notices?