Solved

Check for flag file

Posted on 2014-04-05
3
349 Views
Last Modified: 2014-04-06
I am not sure how, but I just got an error that said:

Illegal division by zero at at line... This is the line it is complaining about. I am just trying to check to see if there is a flag present, and if there is to quit the program, if there is not, to continue. I have no idea how I got to the point that it is complaining about dividing by zero.

Does anyone see where the problem is?

   if (-e $results_dir/flags/stop.flag) {
      die "STOP Flag Present. \n";
   }

Open in new window

0
Comment
Question by:stakor
3 Comments
 
LVL 28

Accepted Solution

by:
FishMonger earned 400 total points
ID: 39980559
You forgot the quotes around the path.

if (-e "$results_dir/flags/stop.flag") {

Open in new window

0
 
LVL 84

Assisted Solution

by:ozo
ozo earned 100 total points
ID: 39980618
To see how perl was interpreting it without the quotes:
perl -MO=Deparse,-p -e '-e $results_dir/flags/stop.flag'
(-e ((($results_dir / 'flags') / 'stop') . 'flag'));

and enableing warnings:
perl -w -e '-e $results_dir/flags/stop.flag'
Unquoted string "flags" may clash with future reserved word at -e line 1.
Unquoted string "stop" may clash with future reserved word at -e line 1.
Unquoted string "flag" may clash with future reserved word at -e line 1.
Name "main::results_dir" used only once: possible typo at -e line 1.
Argument "flags" isn't numeric in division (/) at -e line 1.
Use of uninitialized value $results_dir in division (/) at -e line 1.
Illegal division by zero at -e line 1.
0
 

Author Closing Comment

by:stakor
ID: 39981064
FishMonger had the correct answer. Ozo went way out the way to provide a very detailed answer. I wish I could add more points.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
A short film showing how OnPage and Connectwise integration works.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now