#!/usr/bin/perl use strict; use warnings; sub process_para { my ($para) = @_; if (my ($id) = $para =~ /^ [ ]* (\S+)/x) { if ($id !~ /^.*clk\[\d\]\z/) { $para =~ s/^ [ ]* QUALIFIED [ ]* \n//xmg; } } print($para); } my ($depth, $buf,$stuff); print ("Please enter the location:\n"); chomp ($stuff=); open DATA, $stuff or die "Cannot open $stuff for read :$!"; while () { $buf .= $_; ++$depth if /\(\s*$/; --$depth if /^\s*\)\s*$/; #printf("[%d] %s", $depth, $_); if (!$depth) { &process_para($buf); $buf = ''; } } die("Bad nesting\n") if $depth; }