Final working code:
my $tid; my $buf; my $test = "TEST SYSTEM"; my $tool = "REFERENCE TOOL"; my $db = "DEBUG SYSTEM"; my $arc = "ARCADE SYSTEM"; my $jp = "Japan"; my $usa = "United States"; my $eu = "Europe"; my $kor = "Korea"; my $uk = "United Kingdom"; my $mex = "Mexico"; my $au = "Australia"; my $sa = "South Asia"; my $tw = "Taiwan"; my $rs = "Russia"; my $ch = "China"; my $hk = "Hong Kong"; my $bz = "Brazil"; seek ($flash, 0x2F074, 0); read ($flash, my $temp, 0x02); my $dat = unpack('H*', $temp); my $data = uc$dat; if ($data eq "8000" || $data eq "0080"){ $tid = "TEST"; $buf = $test; } elsif ($data eq "8100" || $data eq "0081"){ $tid = "TOOL"; $buf = $tool; } elsif ($data eq "8200" || $data eq "0082"){ $tid = "DEX"; $buf = $db; } elsif ($data eq "8300" || $data eq "0083"){ $tid = "CEX"; $buf = $jp; } elsif ($data eq "8400" || $data eq "0084"){ $tid = "CEX"; $buf = $usa; } elsif ($data eq "8500" || $data eq "0085"){ $tid = "CEX"; $buf = $eu; } elsif ($data eq "8600" || $data eq "0086"){ $tid = "CEX"; $buf = $kor; } elsif ($data eq "8700" || $data eq "0087"){ $tid = "CEX"; $buf = $uk; } elsif ($data eq "8800" || $data eq "0088"){ $tid = "CEX"; $buf = $mex; } elsif ($data eq "8900" || $data eq "0089"){ $tid = "CEX"; $buf = $au; } elsif ($data eq "8A00" || $data eq "008A"){ $tid = "CEX"; $buf = $sa; } elsif ($data eq "8B00" || $data eq "008B"){ $tid = "CEX"; $buf = $tw; } elsif ($data eq "8C00" || $data eq "008C"){ $tid = "CEX"; $buf = $rs; } elsif ($data eq "8D00" || $data eq "008D"){ $tid = "CEX"; $buf = $ch; } elsif ($data eq "8E00" || $data eq "008E"){ $tid = "CEX"; $buf = $hk; } elsif ($data eq "8F00" || $data eq "008F"){ $tid = "CEX"; $buf = $bz; } elsif ($data eq "A000" || $data eq "00A0"){ $tid = "ARC"; $buf = $arc; } else { $tid = "UNKNOWN"; $buf = "UNKNOWN"; } $lb3->Append("$tid") ; $lb4->Append("$buf") ;
funny thing is, this also wasnt working either ;0
what i believe was messing me up was the capitalization, because it wasnt working until i uppercased the output from unpack 'H*'

anyways this is working flawless :D
thanks for steering me in the right direction because this saved me from having twice as many lines :)
EDIT: now 500 dollars who can do this in a one liner :P

In reply to Re: perl unpack and matching the unpacked data by james28909
in thread perl unpack and matching the unpacked data by james28909

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.