in reply to Re: XYZ Manipulation
in thread XYZ Manipulation

Okay. I fixed that, but also get warnings. I'm unsure of the undef issue as well.
String found where operator expected at ./t2 line 29, near "<OUT> "%s + to %s Distance-%.5f\n"" (#1) (S syntax) The Perl lexer knows whether to expect a term or an ope +rator. If it sees what it knows to be a term when it was expecting to see + an operator, it gives you this warning. Usually it indicates that an operator or delimiter was omitted, such as a semicolon. (Missing operator before "%s to %s Distance-%.5f\n"?) syntax error at ./t2 line 29, near "<OUT> "%s to %s Distance-%.5f\n"" Execution of ./t2 aborted due to compilation errors (#2) (F) Probably means you had a syntax error. Common reasons include +: A keyword is misspelled. A semicolon is missing. A comma is missing. An opening or closing parenthesis is missing. An opening or closing brace is missing. A closing quote is missing. Often there will be another error message associated with the synt +ax error giving more information. (Sometimes it helps to turn on -w. +) The error message itself often tells you where it was in the line +when it decided to give up. Sometimes the actual error is several toke +ns before this, because Perl is good at understanding random input. Occasionally the line number may be misleading, and once in a blue + moon the only way to figure out what's triggering the error is to call perl -c repeatedly, chopping away half the program each time to se +e if the error went away. Sort of the cybernetic version of 20 ques +tions. Uncaught exception from user code: syntax error at ./t2 line 29, near "<OUT> "%s to %s Distance-%.5f +\n"" Execution of ./t2 aborted due to compilation errors.

Replies are listed 'Best First'.
Re^3: XYZ Manipulation
by toolic (Bishop) on Jun 15, 2015 at 17:59 UTC
    My code does not use angle brackets around OUT. Is your code: printf <OUT> ... ? If so, then you incorrectly copied my code.
      It actually was. I had tried that with another comment, and forgot to change it back. Thanks. Now, I am getting issues with the array, and to be honest I'm kinda clueless. (Though you could probably tell.) I got the issue :
      Useless use of array element in void context at ./t2 line 30 (#1) (W void) You did something without a side effect in a context that + does nothing with the return value, such as a statement that doesn't re +turn a value from a block, or the left side of a scalar comma operator. +Very often this points not to stupidity on your part, but a failure of +Perl to parse your program the way you thought it would. For example, +you'd get this if you mixed up your C precedence with Python precedence +and said $one, $two = 1, 2; when you meant to say ($one, $two) = (1, 2); Another common error is to use ordinary parentheses to construct a + list reference when you should be using square or curly brackets, for example, if you say $array = (1,2); when you should have said $array = [1,2]; The square brackets explicitly turn a list value into a scalar val +ue, while parentheses do not. So when a parenthesized list is evaluat +ed in a scalar context, the comma is treated like C's comma operator, wh +ich throws away the left argument, which is not what you want. See perlref for more on this. This warning will not be issued for numerical constants equal to 0 + or 1 since they are often used in statements like 1 while sub_with_side_effects(); String constants that would normally evaluate to 0 or 1 are warned about. Missing argument in printf at ./t2 line 29, <IN> line 5 (#2) (W uninitialized) A printf-type format required more arguments tha +n were supplied. Use of uninitialized value in subtraction (-) at ./t2 line 38, <IN> li +ne 5 (#3) (W uninitialized) An undefined value was used as if it were alread +y defined. It was interpreted as a "" or a 0, but maybe it was a mi +stake. To suppress this warning assign a defined value to your variables. To help you figure out what was undefined, perl will try to tell y +ou the name of the variable (if any) that was undefined. In some cas +es it cannot do this, so it also tells you what operation you used th +e undefined value in. Note, however, that perl optimizes your progr +am anid the operation displayed in the warning may not necessarily ap +pear literally in your program. For example, "that $foo" is usually optimized into "that " . $foo, and the warning will refer to the concatenation (.) operator, even though there is no . in your program.
      Which, seems fairly self-evident to fix, but I am unsure how to. I tried changing the parenthesis around  (0 .. $#data) to [..], like the error suggested.