CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Why was error reported for missing '\' when printing array?


New User

Jan 7, 2007, 8:52 PM

Post #1 of 2 (1159 views)
Why was error reported for missing '\' when printing array? Can't Post

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:-

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)
2871 {
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";
2875 }

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.

New User

Jan 7, 2007, 9:17 PM

Post #2 of 2 (1158 views)
Re: [7force] Why was error reported for missing '\' when printing array? [In reply to] Can't Post

I found out why after going through some sites and getting real lucky with one. Smile

Here is what I found for the benefit of others who may encounter the same issue, or helps to avoid it.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives