... open(my $csv_fh, "<",$Datei_in) or die "...: $!"; my @csv_lines = map {chomp;} <$csv_fh>; my $temp = ...; # string in which "Item n" has to be replaced $temp =~ s/Item (\d+)/$csv_line[$1-1]/ge; # replace "Item 1" with $csv_line[0]