Solved

Check for flag file

Posted on 2014-04-05
3
354 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Six Sigma Control Plans

626 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