"Please do the needful"
Does this help? I expect it only helps a little. That's the difference between asking for a solution and asking to be taught how to implement a solution. Saying "I donno perl" but then not trying to learn it, when you want to use it, is just silly. Please review the tutorials already shown to you.
use strict; use warnings; use feature 'say';
use Data::Dumper;
chomp( my @lines = <DATA> );
shift @lines;
my @output = map { /(\S+)\s+(\S+)/; my $dir = $2 eq 'WR' ? 'wire' : 'r
+eg'; "$dir $1" } @lines;
say Dumper \@output;
__END__
Description RD/WR
lfxosc_bp_c_jtag WR
lfxosc_pd_c_jtag WR
lfxosc_i_mult_ctrl_c_jtag[0] WR
lfxosc_i_mult_ctrl_c_jtag[1] WR
lfxosc_i_mult_ctrl_c_jtag[2] WR
lfxosc_r_ref_ctrl_c_jtag[0] WR
lfxosc_r_ref_ctrl_c_jtag[1] WR
lfxosc_r_ref_ctrl_c_jtag[2] WR
rd_rsrv_hfxosc_jtag RD
rd_rsrv_hfxosc_jtag RD
Output:
$ perl 1196402.pl
$VAR1 = [
'wire lfxosc_bp_c_jtag',
'wire lfxosc_pd_c_jtag',
'wire lfxosc_i_mult_ctrl_c_jtag[0]',
'wire lfxosc_i_mult_ctrl_c_jtag[1]',
'wire lfxosc_i_mult_ctrl_c_jtag[2]',
'wire lfxosc_r_ref_ctrl_c_jtag[0]',
'wire lfxosc_r_ref_ctrl_c_jtag[1]',
'wire lfxosc_r_ref_ctrl_c_jtag[2]',
'reg rd_rsrv_hfxosc_jtag',
'reg rd_rsrv_hfxosc_jtag'
];
The way forward always starts with a minimal test.
|