Jan 7, 2007, 8:52 PM
Post #1 of 2
I created a script for my team members usage. All seems well initially but recently, two of my team members encountered an error as follow:-
Why was error reported for missing '\' when printing array?
In string, @log_data now must be written as \@log_data at parser_script line 2874, near "DEBUG : Value written: @log_data"
Execution of parser_script aborted due to compilation errors.
parser_script is the script I created, and @log_data is an array to store the current line being parsed. If an error is encountered while parsing this line, I will print the entire line in a log file for debugging later. Below is the code snippet pertaining to line 2874:-
2869 # Verify everything is in order
2870 if( $i != $max && $data_count != 0)
2872 print STDERR "Incorrect value count!\n";
2873 print LOG "WARNING : Incorrect value count for $_[$max]\n";
2874 print LOG "DEBUG : Value written: @log_data\n";
On my side using my account, I can compile successfully without any errors. I even added the '\' as per error reported above and as expected, no error as well on my side. I would most probably add the '\' to eliminate the error encountererd by my some of my team members as follow:-
2874 print LOG "DEBUG : Value written: \@log_data\n";
However, I was just wondering why was the error encountered by some and not all? Does it have anything to do with compiler or environment settings?
Thanks in advance for any info.