Hi all,
I've been coding PERL for a moment but I've come to a wall. My program is supposed to read an array, and report every element on it's line, one for each element. The thing is that the same coding acts differently in the terminal and in the logged file. Here's a sample:
In the console it's writting every error stored and it respects the escape sequences as intented:
See the way it is all messed up. Tried different things but I just can't figure what is going on. Please anyone got an idea how to do that ? I ate my fingers already and going for the whole arm...
I've been coding PERL for a moment but I've come to a wall. My program is supposed to read an array, and report every element on it's line, one for each element. The thing is that the same coding acts differently in the terminal and in the logged file. Here's a sample:
Code:
#!/usr/bin/perl -W
use strict;
require 5.001;
my @errors;
open (LogFile, ">>LocationOfLogFile")
push (@errors,"Program error 1:\n\t$!\n\n");
push (@errors,"Program error 2:\n\t$!\n\n");
push (@errors,"Program error 3:\n\t$!\n\n");
print ("\nErrors Encountered in \@errors:\n\n@errors");
print LogFile ("\nErrors Encountered in \@errors:\n\n@errors");
print ("\nEnd of program");
In the console it's writting every error stored and it respects the escape sequences as intented:
but in the logged file:Errors Encountered in @errors:
Program error 1:
File cannot be found....blablabla <- this is the $! variable
Program error 2:
Another error reported on it's line...
Program error 3:
And one more...
End of program
Errors Encountered in @errors:
Program error 1:File cannot be found....blablablaProgram error 2:Another error reported on it's line...Program error 3:And one more...
End of program
See the way it is all messed up. Tried different things but I just can't figure what is going on. Please anyone got an idea how to do that ? I ate my fingers already and going for the whole arm...