When you do a print, the default record separator used by Perl is a space.
When perl interpolates an array within a string, it places the record
separator between each record.  If you take out the double-quotes around
@comments, you will get the output you are looking for.

-----Original Message-----
From: Bryan R Harris [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 5:10 PM
To: [EMAIL PROTECTED]
Subject: extra space



This list is for beginners, right?  =)

I read in a file, then strip all lines that start with "#" or "\n".  When I
print them out, though, the first line is left justified correctly but the
rest have a single space in front of them.  Any ideas why?

$file = "somefile.dat";
open (FILE, $file)  || die("Couldn't open $file: $!\n");
@_ = <FILE>;
close(FILE);
while ($_[1] =~ /^[#\n]/) { push(@comments, shift(@_)); }
print "@comments";

TIA.

- B


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to