is there anyone who know how to deal with vector?
i have 2 files as below:
Expand|Select|Wrap|Line Numbers
- file1.doc
- ::component
- list
- ::Start
- green[2:0] in grp1
- blue in grp2
- orange[3:0] in grp3
- red[4:0] in grp5
- yellow in grp4
- ::End
- Lab
- ::Engineering
- ____________________________________________________
- file1_fast.txt
- dont_touch : true ;
- area : 1 ;
- _power : 0.000 ;
- direction : inout ;
- capacitance : 123.456 ;
- /* automatically added to prevent m < errors */
- capacitance : 29.7 ;
- }
- name(green1) {
- direction : input ;
- capacitance : 14.370 ;
- }
- name(blue) {
- direction : input ;
- capacitance : 432;
- }
- name(green2) {
- direction : input ;
- capacitance : 14.370 ;
- }
- name(yellow) {
- direction : input ;
- capacitance : 432;
- }
- name(orange1) {
- direction : input ;
- capacitance : 15.5 ;
- }
- direction : input ;
- capacitance : 104 ;
- name(orange2) {
- direction : input ;
- capacitance : 15.5 ;
- }
- direction : input ;
- capacitance : 104 ;
- }
- name(red1) {
- direction : input ;
- capacitance : 14.370 ;
- }
- name(red2) {
- direction : input ;
- capacitance : 432;
- }
- name(red4) {
- direction : input ;
- capacitance : 15.5 ;
- }
- direction : input ;
- capacitance : 104 ;
- name(red6) {
- direction : input ;
- capacitance : 14.370 ;
- }
- name(orange5){
- direction : input ;
- capacitance : 432;
- }
- name(orange6) {
- direction : input ;
- capacitance : 15.5 ;
Expand|Select|Wrap|Line Numbers
- file1.doc
- green1
- green2
- blue
- orange1
- orange2
- orange3
- red1
- red2
- red3
- red4
- yellow
- file1_fast.txt
- green1
- green2
- blue
- orange1
- orange2
- orange5
- orange6
- yellow
- red1
- red2
- red4
- red6
Expand|Select|Wrap|Line Numbers
- use Data::Dumper;
- my $doc = '/home/assignment/file1.doc';
- my $txt = '/home/assignment/file1_fast.txt';
- open my $df, "<", $doc or die "can't open $doc: $!";
- my @listDoc;
- while (<$df>)
- {
- if (/^::start/../^::start/)
- {
- next if /^::/;
- my ($infoDoc) = split / /;
- push @listDoc, $infoDoc;
- }
- }
- my %hash;
- open my $ff, "<", $txt or die "Can't open $txt: $!";
- while (my $lineFast = <$ff>)
- {
- if ($lineFast =~ /name\((\w+)\)/)
- {
- $hash{$1}='';
- }
- }
- print Dumper \@listDoc, \%hash;
- print "\n====================\n", join "\n", grep {!exists $hash{$_}} @listDoc;
- print "\n\n";