in reply to Reading content of many files in an array

You can remove the newlines with chomp, then join to make a single line:

foreach $member (@memberlist) { open(FILE, "$member.dat") or die $!; lock(FILE); @members = <FILE>; chomp(@members); push @allmembers, join( " ", @members); unlock(FILE); close(FILE) or die $!; # remove this # foreach $line (@members) { # push(@allmembers, $line); # } }

Update: Fixed a blunder, props to wog.

Update2: Should have also corrected your open and close, props to tilly.

After Compline,
Zaxo