Hello, you asked the wrong question: if you split your file
using "module xxx/endmodule" you end up with two empty lines.
What you really want is to grab everything between two markers to go in separates files. I underline this because the wrong question preclude you to obtain good answers.
In the case you describe you'll find very useful the flip-flop operator, a not well known operator, very useful insetad, described in the
docs
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my @files;
my $file_index=0;
while (<DATA>) {
if ($_ =~ /^module\s+/ .. /endmodule$/){
$files[$file_index].=$_;
}
else {++$file_index;}
}
print scalar @files," elements in \@files:\n",Dumper (\@files);
__DATA__
module soc (PAD_TEST , VDIG_ON , GNDD_ON , VPP_EF , PAD_BOND_OPT );
inout [31:0] PAD_TEST ;
input VDIG_ON ;
input GNDD_ON ;
inout VPP_EF ;
inout [5:0] PAD_BOND_OPT ;
endmodule
module analog_atop_wrapper (PAD_VDDTX , PAD_VREFADC , PAD_VSSRF ,
DPAD_GSUB_XTAL24M , DPAD_GSUB_RX );
inout PAD_VDDTX ;
inout PAD_VREFADC ;
inout PAD_VSSRF ;
inout DPAD_GSUB_XTAL24M ;
inout DPAD_GSUB_RX ;
endmodule
module misc_atop_wrapper (VDIG , VRTC , AVDD , EBUS , IOGND , VDIG_ON
+);
inout VDIG ;
inout VRTC ;
inout AVDD ;
inout EBUS ;
inout IOGND ;
input VDIG_ON ;
endmodule
HtH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.