my $fff=($filenam[0],"_header",".txt"); to my $fff=$filenam[0] . "_header" . ".txt";