tl;dr, but... for parsing a VCD file, don't reinvent this wheel if you don't have to: Verilog::VCD. For example, the following code parses your VCD file and shows all signal names, times and values:
use warnings FATAL => 'all'; use strict; use Verilog::VCD qw(parse_vcd); my $file = shift; my $vcd = parse_vcd($file); for my $code (keys %{ $vcd }) { my $name = "$vcd->{$code}{nets}[0]{hier}.$vcd->{$code}{nets}[0]{n +ame}"; my $times = @{ $vcd->{$code}{tv} }; for my $aref (@{ $vcd->{$code}{tv} }) { print "$name @{ $aref }\n"; } } __END__ JUNKSIGNALS_TB.RIGHT 0 1 JUNKSIGNALS_TB.RIGHT 10 0 JUNKSIGNALS_TB.SERIAL 0 1 JUNKSIGNALS_TB.I2 0 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx5_out 0 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx3_out 0 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx4_out 0 1 JUNKSIGNALS_TB.I1 0 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx2_out 0 1 JUNKSIGNALS_TB.DUTJNKCELL.lnx2_out 10 0 JUNKSIGNALS_TB.ZEN 0 1 JUNKSIGNALS_TB.ZEN 10 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx0_out 0 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx0_out 10 1 JUNKSIGNALS_TB.DUTJNKCELL.lnx1_out 0 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx1_out 10 1 JUNKSIGNALS_TB.I0 0 0 JUNKSIGNALS_TB.I0 10 1

If you can explain in words what you are trying to accomplish, I can try to help (I speak Verilog). Also keep in mind that hashes are un-ordered in Perl, and generally, you want to sort the keys.

UPDATE: A few years ago, some translated this Perl code to Python: https://pypi.python.org/pypi/Verilog_VCD


In reply to Re: Why are Hash keys different for the same hash? Confusing. (VCD) by toolic
in thread Why are Hash keys different for the same hash? Confusing. by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.