herman4016 has asked for the wisdom of the Perl Monks concerning the following question:
__DATA__ x# x' x( x$ x) bxxx * x" x% x& $end $dumpoff $end #3537871350 $dumpon $end 0& 0% 0$ b01 + 0! 0( 0# 1' 0" z) b111 * #3537876550 1! #3537881760 0! #3537886970 1! #3537892180 0!
How do I extract text from #3537871350 to #3537876550 Thanks!! following is my code
__CODE__ open my $fh, "sample.vcd" or die $!; my $fields_t0=0; my @fields_mod=(); my $re = qr{\$dumpoff \$end(\#[\d]+)\$dumpon \$end(.*)\#[\d]+}s; #open $fh; { my $i=0; local $/ = ""; while (<$fh>) { if (/$re/) { $fields_t0 = $1 ; say "match!!"; @fields_mod = split /\s+/ , $2; } } } say $fields_t0; foreach my $field (@fields_mod) { say $field; }
|
|---|