If the data was in ASN.1 format you would need an ASN.1 grammar to parse it. However, that doesn't look like ASN.1 data.

Here is a simple (non-ASN.1) decoder based on your specification:

#!/usr/bin/perl -w use strict; my $message = pack 'H*', join '', qw( 9f a1 0b 00 9f a1 0b 00 9f be 00 02 00 15 9f be 01 81 0f 01 55 18 f3 0b 24 99 20 10 00 10 00 00 00 01 9f be 19 81 09 00 01 10 60 18 00 38 38 11 9f be 1b 08 02 01 10 ff ff ff ff ff a1 06 82 04 04 00 00 00 ); _unpack_message($message); sub _unpack_message { my $message = shift; print "Tag Length Data\n"; while ($message) { my $tag = unpack 'H6', substr $message, 0, 3, ''; my $length = unpack 'C', substr $message, 0, 1, ''; if ($length == 0x81) { $length = unpack 'C', substr $message, 0, 1, ''; } my $template = 'H' . $length * 2; my $data = unpack $template, substr $message, 0, $leng +th, ''; printf "%s %-6d %s\n", $tag, $length, $data; } } __END__ Prints: Tag Length Data 9fa10b 0 9fa10b 0 9fbe00 2 0015 9fbe01 15 015518f30b24992010001000000001 9fbe19 9 000110601800383811 9fbe1b 8 020110ffffffffff a10682 4 04000000

--
John.


In reply to Re: How to use Convert::ASN1 ? by jmcnamara
in thread How to use Convert::ASN1 ? by bh_perl

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.