Solved

Check for flag file

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl Sort Question 4 133
Perl Scripting from a shell script with if and for 4 85
stftime format 4 55
Matching a random pattern with one common character 2 59
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 …
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

786 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