anirbanphys has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I need a perl utility, which will read two files (user will provide two files), put the contents of each file into two separate arrays and by using some algorithm it will print the custom merging array results.
Please refer the two files
File_1 => cell_list
c_1_mm c_2_mm c_3_mm c_4_mm
File_2 => pvt_list
1 2 3 4 5 6 7 8 9 0
After running the utility it should print in a file according to below OUTPUT file.
c_1_mm_1 c_2_mm_1 c_3_mm_1 c_4_mm_1 c_1_mm_2 c_2_mm_2 c_3_mm_2 c_4_mm_2 c_1_mm_3 c_2_mm_3 c_3_mm_3 c_4_mm_3 c_1_mm_4 c_2_mm_4 c_3_mm_4 c_4_mm_4 c_1_mm_5 c_2_mm_5 c_3_mm_5 c_4_mm_5 c_1_mm_6 c_2_mm_6 c_3_mm_6 c_4_mm_6 c_1_mm_7 c_2_mm_7 c_3_mm_7 c_4_mm_7 c_1_mm_8 c_2_mm_8 c_3_mm_8 c_4_mm_8 c_1_mm_9 c_2_mm_9 c_3_mm_9 c_4_mm_9 c_1_mm_0 c_2_mm_0 c_3_mm_0 c_4_mm_0
I only written the few lines
#!/usr/bin/perl use strict; use warnings; my $cell_list = $ARGV[0]; # input cell_list my $pvt_list = $ARGV[1]; # input pvt_list if ($#ARGV!=1) { print "USAGE :: perl max_tran_update.pl <<cell_list>> <<PVT_LIST>> +\n\n" ; exit(1); } open (CFILE,"<","$cell_list") || die "Can not open cell_list"; open (PFILE,"<","$pvt_list") || die "Can not open pvt_list"; my @cell_file = <CFILE>; my @pvt_file = <PFILE>;
And trying to understand how I put those arrays in loop. Please help me to understand how this can be done.....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Merging of custom array
by choroba (Cardinal) on Jul 19, 2019 at 12:09 UTC | |
by anirbanphys (Beadle) on Jul 19, 2019 at 12:28 UTC | |
|
Re: Merging of custom array
by Fletch (Bishop) on Jul 19, 2019 at 12:56 UTC | |
|
Re: Merging of custom array
by BillKSmith (Monsignor) on Jul 19, 2019 at 14:03 UTC | |
by jwkrahn (Abbot) on Jul 19, 2019 at 19:40 UTC | |
by haukex (Archbishop) on Jul 20, 2019 at 08:18 UTC | |
|
Re: Merging of custom array
by jwkrahn (Abbot) on Jul 19, 2019 at 19:52 UTC | |
by anirbanphys (Beadle) on Jul 22, 2019 at 07:29 UTC |