Perl string formation from array

HI I ma using perl programming

my perl is like this

 
$InputFile = $ENV{UDE_TMP} . "/" ."cre_fmr_gen.temp_data_file_gen.dat";
@duplicates = `cat $InputFile | cut -d "|" -f 1,1 | sort | uniq -c | awk '{ if(\$1>1) {print \$2;}}'`;
my $cusiplist ;
foreach $cusip (@duplicates)
{
print("instrument is   $cusip"); 
$cusiplist = $cusiplist . "|" . $cusip  ;
}
print($cusiplist);
$tmp_file_1 = $ENV{UDE_TMP} . "/" ."prabhu1";
$tmp_file_2 = $ENV{UDE_TMP} . "/" ."prabhu2";
print($tmp_file_2 );
#$InputFile = $ENV{UDE_TMP} . "/" ."cre_fmr_gen.temp_data_file_gen.dat";
print ("$InputFile ");
use File::Copy;
copy( "$InputFile" , "$InputFile.CP.Prabhu");
$cmd = `cat $InputFile | egrep '$cusiplist'  > $tmp_file_1`;
#$cmd= `cat $InputFile  >$tmp_file_I`;
system(cmd);
print($cmd);

so now i am getting the out put as

instrument is   FN110OY12
instrument is   FN112OY10
instrument is   FN112OY11
instrument is   FN112OY12
instrument is   FN114OY03
instrument is   FN114OY09
instrument is   FN114OY10
instrument is   FN114OY11
instrument is   FN114OY12
instrument is   FN116OY03
instrument is   FN116OY04
instrument is   FN116OY05
instrument is   FN116OY09
instrument is   FN116OY10
instrument is   FN118OY03
instrument is   FN118OY04
instrument is   FN118OY05
instrument is   FN118OY08
instrument is   FN118OY09
instrument is   FN118OY10
instrument is   FN120OY03
instrument is   FN120OY08
instrument is   FN122OY05
instrument is   FN122OY07
instrument is   FN124OY08
|FN110OY12
|FN112OY10
|FN112OY11
|FN112OY12
|FN114OY03
|FN114OY09
|FN114OY10
|FN114OY11
|FN114OY12
|FN116OY03
|FN116OY04
|FN116OY05
|FN116OY09
|FN116OY10
|FN118OY03
|FN118OY04
|FN118OY05
|FN118OY08
|FN118OY09
|FN118OY10
|FN120OY03
|FN120OY08
|FN122OY05
|FN122OY07
|FN124OY08
/itf/ude/tmp/prabhu2/itf/ude/tmp/cre_fmr_gen.temp_data_file_gen.dat 

But I wanted to make a string like this

'FN112OY12|FN114OY10|FN116OY03|FN116OY04|FN116OY05|FN118OY03|FN118OY04|FN118OY05|FN118OY08|FN118OY10|FN120OY02
|FN120OY08|FN122OY05|FN124OY08'

what needs to be done?

Well, you need to remove the first pipe mark or not append a pipe on the first item, and it seems you are carrying forward a line feed on the right side of every cusip, nice for the instrument is line but a probem for the desired long line. Beginner's Introduction to Perl - Perl.com PERL print does not add or remove line feeds.