in reply to Re^2: combining 2 files with a comon field
in thread combining 2 files with a comon field

You forgot a semicolon on the line
my $second
oh, and on the line
my $line = $_
too.

That would solve your immediate syntax problem. But it doesn't solve the semantic problem: that it doesn't do what you want. For example, there is no connection between your value for $second and your hash key. That connection is in the value for $first. It'd work somewhat better if you incorporated your final loop body (but without the loop) into the one reading the second file. And you're making the classic newbie error of not backwhacking the "|" for split — and it's easier to use a regex for split, otherwise you'd even have to double the backslash.

while(<>) { my $line = $_; my($first, $second) = split(/\|/, $line); # or: "\\|" my @list = ($hash{$first}, $second); $joined = "@list"; # joins with space by default (see $" ) $hash{$first} = $joined; }