#!/usr/bin/perl #use strict; use warnings; open(IHF, "<", "top.spef"); while( ) { my @keys; my ($n, $k1); my %nets; my @net; my $item; next if (/^\n/); s/\*//g; s/^\s//g; s/\//:/g; ### Here we store the lines between the lines ### NAME_MAP and PORT into a hash called %mapping" ### and print the key,value pairs if (/NAME_MAP/ .. /PORTS/) { next if (/NAME_MAP/); next if (/PORTS/); %mapping = split; @keys = sort keys %mapping; foreach $k1 (sort keys %mapping) { print "$k1 = $mapping{$k1}\n"; } } if (/D_NET/) { my @anet = split; %nets = ($anet[1] , $anet[0]); for $n (sort keys %nets) { print "$mapping{$n}\n"; } } }