unwanted leading whitespace when using print

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
The following bit of code adds unwanted whitespace at the beginning of
some lines. It looks like the /n in the added text is not interpret
correctly. Using komodo debugger I cannot pinpoint the problem. The
generic array is filled correctly, only after the print the output is
See  code and output:
<begin code>
my @generic;
my @allGeneric;

# read some lines from file, no specific mark up
# store matching lines in @genreric
FH = open "<", "Some file.txt";

while (<FH>)
  if ($line =~ /some match/)
    push (@generic, $line);
close FH;

#add some trailing text
#remove first element since it si always empty due to push

push (@generic, "\nSee some place: \n");
splice (@generic, 0,1);
push (@allGeneric,"*"x80 . "\n");
push (@allGeneric,@generic);

print "The system folder is ...\n\n";
print "===== Generic actions =====\n";
print "@allGeneric\n";
<end code>

This produces:
<begin output>
The system folder is ...

===== Generic actions =====
 Ja, we hebben hier een heleboel werk om alles goed te krijgen met
allerlei linefeeds en line dingetjes waar  ik niet zo'n goed zicht op
heb in perl gebruik. Daarom is het af en toe ook wel lastig, maar toch
ook wel (heel) erg vaak.

 En soms: treedt er een 'panic' of "dubbele quote" op, maar mag dat?

See some place:

<end output>

Note the leading whitespace before 'Ja, ' and before 'En soms'.

Any help?
( I am using
This is perl, v5.8.7 built for MSWin32-x86-multi-thread
(with 7 registered patches, see perl -V for more detail)

Copyright 1987-2005, Larry Wall

Binary build 813 [148120] provided by ActiveState http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Jun  6 2005 13:36:37

Re: unwanted leading whitespace when using print

Quoted text here. Click to load it
Quoted text here. Click to load it

Oops, I just read FAQ 5.39 :-)

Site Timeline