Solved

Check for flag file

Posted on 2014-04-05
3
347 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
String Substitution 4 65
Validating the data using Oracle DBD module. 5 62
Port 80 requests 16 79
problem with using the glob function 1 57
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 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

10 Experts available now in Live!

Get 1:1 Help Now