Solved

Check for flag file

Posted on 2014-04-05
3
353 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Migrate OTRS to newest version. 1 610
How to get all the API from website? 11 161
quoting a comma separated list 20 93
html form to write data to csv 24 228
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…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…

752 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