my @result; my @result1; my @result2; my $b; my $c; my $d; my $ifile51 = '../test.txt'; my $ofile51 = 'seq.txt'; open (my $ifh51, '<', $ifile51) or die $!; open (my $ofh51, '>', $ofile51) or die $!; while(my $line51 = <$ifh51>) { # my $line51 = $_ if /\bbist_mode\b/; @result = grep (/bist_mode/, $line51); @result1 = grep (/mode_sel/, $line51); @result2 = grep (/mem_type_sel/, $line51); $b = join("_",@result); $b =~ s/,([^,]*$)/$1/; $c = join("_",@result1); $c =~ s/,([^,]*$)/$1/; $d = join("_",@result2); $d =~ s/,([^,]*$)/$1/; print $b; print $c; print $d; } print $b; print $c; print $d;
This code prints the value of b,c,d inside while loop but not outside while loop , what may be the problem ?
The text file contains
bist_ctlr_clk_bistctlr,
bist_ctlr_rst_bistctlr_n,
bist_ctlr_serial_in_system,
bist_ctlr_serial_out_system,
bist_ctlr_shift_en_system,
bist_ctlr_global_bbad,
bist_ctlr_global_repairable,
bist_ctlr_bist_mode,
bist_ctlr_mem_type_sel,
bist_ctlr_mode_sel,
bist_ctlr_memsafe,
bist_ctlr_sif_reg_en_system,
bist_ctlr_sif_load_en_system,
bist_ctlr_sif_update_en_system,
bist_ctlr_mem_atpg_mode,
bist_ctlr_flash_data_select,
bist_ctlr_flash_repair_data,
bist_ctlr_bend,
Outside the loop it should print
bist_ctlr_bist_mode
bist_ctlr_mem_type_sel
In reply to Not printing the values outside the while loop by suvendra123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |