#!/usr/bin/perl use strict; my $c_inFile = q{countries_list.csv}; open my $c_INFILE, q{<}, $c_inFile or die "Can't open countries_list.csv : $!"; my $c_outFile = q{test_list.csv}; open my $c_OUTFILE, q{>}, $c_outFile or die "Can't open countries_list.csv : $!"; my $country; while (my $line = <$c_INFILE>){ chomp($line); my @Elements = split(";",$line); $country = $Elements[0]; print $c_OUTFILE "the country is p${country}p\n"; } close $c_INFILE; close $c_OUTFILE;