Hi, I'm new to PERL and would like to seek help for the task mentioned below: I'm attempting to read the contents of a file containing rows with the format shown below: version|exchange|area|date|time|callmod|callid|callno1|callno2|part2|start_date|start_time|spare|dur|flag_ini|indicator|length|ni|calling_nai|screening|address_i|num_plan_ind|publicservice_user|spare1|spare2|calling_no|line_no|spare3|spare4|called_nai|called_num_plan_ind|spare5|called_num|spare6|di_nai|di_num_plan_ind|spare7|dest_num|dest_num_type|spare8|doc|dccc_type|spare9|dt_update|spare10|subs_type|cug_code|spare11|teleservices|spare12|channel_isdn|calling_terminal|pulses|in_port|out_port|in_pop|out_pop|spare13|out_mod|spare14|link2bb_type|out_cic|in_cic|anomaly_code|anomaly_ind|spare15|spare16|location|cause_value|spare17|final_status|ingress_ip|egress_ip|inter_dur|bid_time|term_call_setup_delay|del_call_setup_delay|term_ccd|int_call_clear_delay|trans_delay|inter_jitter|send_packets|send_octets|rec_packets|rec_octets|lost_packets|lost_packets_out|packet_period|code_alg|spare20|silence_suppr|spare21|coi|spare22| E1440000100TT|006030766|0521|051018|191554|2|1529238851|63271|0|0|051018|184414|0|965|0|0|171|1|3|1|0|1|2|0|0|882030|255|0|0|3|1|0|052539028|0|3|1|0|052539028|1|0|1|0|0|0|0|SNO|0|0|0|0|0|000521882030|1|24086|27368|0|0|0|0|0|0|2|2|0|0|0|0|0|16|0|1|85.38.245.146|83.175.46.150|1|1129653851|142|0|0|0|17093|140|48227|1542980|47896|1532672|258|0||13|0|0|0||| I'm interested in modifying the values at the 3rd and 26th column of 1 particular row in this file and duplicating that row values to populate it to 4000 rows. There are 2123 rows in the this file currently. Below is the script which I've written in order to modify the values at the column mentioned. However, I'm not sure how I could rewrite the newly modified column values of that particular row back into the file - I want to use the particular row which had its columns modified to be duplicated and appended to the end of the current file for a specific number of time (adding more rows with the duplicated rows). version|exchange|area|date|time|callmod|callid|callno1|callno2|part2|start_date|start_time|spare|dur|flag_ini|indicator|length|ni|calling_nai|screening|address_i|num_plan_ind|publicservice_user|spare1|spare2|calling_no|line_no|spare3|spare4|called_nai|called_num_plan_ind|spare5|called_num|spare6|di_nai|di_num_plan_ind|spare7|dest_num|dest_num_type|spare8|doc|dccc_type|spare9|dt_update|spare10|subs_type|cug_code|spare11|teleservices|spare12|channel_isdn|calling_terminal|pulses|in_port|out_port|in_pop|out_pop|spare13|out_mod|spare14|link2bb_type|out_cic|in_cic|anomaly_code|anomaly_ind|spare15|spare16|location|cause_value|spare17|final_status|ingress_ip|egress_ip|inter_dur|bid_time|term_call_setup_delay|del_call_setup_delay|term_ccd|int_call_clear_delay|trans_delay|inter_jitter|send_packets|send_octets|rec_packets|rec_octets|lost_packets|lost_packets_out|packet_period|code_alg|spare20|silence_suppr|spare21|coi|spare22| E1440000100TT|006030766|AAA|BBBB|191554|2|1529238851|63271|0|0|051018|184414|0|965|0|0|171|1|3|1|0|1|2|0|0|882030|255|0|0|3|1|0|052539028|0|3|1|0|052539028|1|0|1|0|0|0|0|SNO|0|0|0|0|0|000521882030|1|24086|27368|0|0|0|0|0|0|2|2|0|0|0|0|0|16|0|1|85.38.245.146|83.175.46.150|1|1129653851|142|0|0|0|17093|140|48227|1542980|47896|1532672|258|0||13|0|0|0||| E1440000100TT|006030766|AAA|BBBB|191554|2|1529238851|63271|0|0|051018|184414|0|965|0|0|171|1|3|1|0|1|2|0|0|882030|255|0|0|3|1|0|052539028|0|3|1|0|052539028|1|0|1|0|0|0|0|SNO|0|0|0|0|0|000521882030|1|24086|27368|0|0|0|0|0|0|2|2|0|0|0|0|0|16|0|1|85.38.245.146|83.175.46.150|1|1129653851|142|0|0|0|17093|140|48227|1542980|47896|1532672|258|0||13|0|0|0||| Could anyone help me out? Thanks Danny
##open file for reading open(INPUTFILE, $inputFile) || die "Cannot open $inputFile \n"; @fileRecs = <INPUTFILE>; $totalRecs = scalar(@fileRecs)-1; print "Total records in $inputFile is $totalRecs \n"; ##open file for writting output open(OUTFILE, ">$inputFile.tmp") || die "Cannot open $inputFile.tmp \n"; $secondRow = $fileRecs[2]; print "BEGINNING -- secondRow = $secondRow \n"; @secondRowRec = split("|", $secondRow); $secondRowRec[2]="AAAA"; $secondRowRec[3]="BBBBB"; print "\$secondRowRec[2] = $secondRowRec[2] and \$secondRowRec[3]=$secondRowRec[3] \n"; print "\$secondRow is now $secondRow \n"; $diffOfNewRec = 4000 - $totalRecs; print "Need to produce additional $diffOfNewRec \n"; #making a backup copy `cp $inputFile $inputFile.tmp`; ## I'm need help here !! Not sure how I could re-join the elements modified back into the array containing that particular row and append it to the end of the file ## print OUTFILE for ($i=0;$i<$diffOfNewRec; $i++){ print OUTFILE "$secondRow\n"; } close OUTFILE; --------------------------------- Yahoo! FareChase - Search multiple travel sites in one click.