i solved the problem by using open (FH_SECOND,"<",\$second_file) or die $!; but can i use the declaration $line_second=; to save the a line in the variable line_second #### open (FH_SECOND, "<", $second_file) or die $!;