> but I can not retrieve the data into $newline with join. Is this bit wrong
Yes, it is a little off.
> $member_array[$count]
This *isn't* an array, it is an *array reference*
> [EMAIL PROTECTED]
Same with this.
Join takes a list of scalars, not a list of references. So you need to
dereference them. I think this is what you are after.
join("\:",@{$member_array[$count]});
Rob
-----Original Message-----
From: Support [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 01, 2004 2:31 PM
To: [EMAIL PROTECTED]
Subject: Writing to file
Hi all
I have a little bit of code you may be able to help with. I load a file into
an array with
foreach $lines(@database_array) {
[EMAIL PROTECTED] = split(/\:/,$lines);
����������������push(@member_array,[EMAIL PROTECTED]);
����������������$x++;
����������������}�� #loop
and then play around with the array a bit, then I would like to load it back
into the file with
while($count<$x){�������
$newline = join("\:",$member_array[$count],[EMAIL PROTECTED]);
chomp($newline);
print DAT "$newline\n";
$count++;
}
but I can not retrieve the data into $newline with join. Is this bit wrong
$member_array[$count],[EMAIL PROTECTED])
or am I missing the point completely or is there another way of doing it.
I am currently loading direct from the file working on that line and them
loading back to file, but I can only change one line at a time. Doing it
with as above I can alter the entire array and then load back to file.
Any help is appreciated and please excuse if I'm in the wrong forum.
Cheers
Colin
----------------------------------------------------------------------------
-------------------
www.rentmyplace.co.nz
The ultimate in that holiday spot away from the maddening crowd
Join as a member today its FREE
List your holiday accommodation for FREE
----------------------------------------------------------------------------
--------------------
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>