Hello monks,
Is there a way to turn off some warnings? For some reason on a Mac perl 5.10.0 the following code will die with a : "Found = in conditional, should be == at line 21." However, on my linux computer with perl 5.12.3, it does not die or offer any warnings whatsoever. I'd like to figure out why this is happening and how to correct it on my linux box so that the warnings always happen.
use warnings FATAL => 'all';
use strict;
my $VERSION = '0.01';
my $program = $0;
my $system = `hostname`;
my $count = 1;
print STDERR "Version $VERSION of $program, running on $system\n";
test_subroutine();
exit;
sub test_subroutine {
my $subroutine = (caller(0))[3];
if ($count < 2 ) {
print "one\n";
} elsif ($count = 2) { # ERROR HERE
print "HA!\n";
} else {
print "three!\n";
}
}
If count is 1 then it prints one, but if it's anything over 1 then it prints HA!.
Update: I am indeed asking why perl is not warning me about the elsif error on my linux box, but is warning me on my Mac box.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.