Your Perlmonks-fu needs work. Your post currently says this:
Hi, i get the error "Can't "last" outside a loop block" and ""syntax error at line 1 : `end of file' unexpected"" when i run the below code. any idea about this...??? < if (-e "testfile") { $check = 0; print "testfile is present\n"; } else { $check = 1; $msg1= "testFile Is Not Avaliable. $timex"; $subj1="testFile Is Not Avaliable "; insertlog($msg1); maildl($msg1, $env, $subj1, $maillst); last; } >
This is, essentially, useless. You should have enclosed your code inside code tags, and this *should* have been obvious when you *previewed* your post.
It should have looked something like this:
if ( -e "testfile" ) { $check = 0; print "testfile is present\n"; }
else {
$check = 1;
$msg1 = "testFile Is Not Avaliable. $timex";
$subj1 = "testFile Is Not Avaliable ";
insertlog($msg1);
maildl( $msg1, $env, $subj1, $maillst );
last;
}
That's just cutting and pasting your code and running it through perltidy. At least now we have a vague idea of what your code looks like. And as it stands, the last isn't necessary -- there's no loop to break out of.
But if there's more to your code, show it to us. Better than that, of course, would be the smallest possible example where the Weird Behaviour is still seen. That way we don't have to paw through dozens (or hundreds) of lines of irrelevant code.
Alex / talexb / Toronto
"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds
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.