Am on a Win2K box, and don't understand the following output & snippet. Can someone plse explain and tell me how to get integers from my string, I am expecting a single integer result to be 114,200 (w/o the comma of course).
string to unpack >0114200<
fmt=A7 >> pr=0114200
fmt=I7 >> pr=875639088
fmt=i7 >> pr=875639088
fmt=L7 >> pr=875639088
fmt=l7 >> pr=875639088

use strict;
use warnings;
my $data='0114200';
print "string to unpack >$data<\n";
my $fmt = 'A7';
my $pr = unpack($fmt,$data);
print "fmt=$fmt >> pr=$pr\n";
$fmt = 'I7';
$pr = unpack($fmt,$data);
print "fmt=$fmt >> pr=$pr\n";
$fmt = 'i7';
$pr = unpack($fmt,$data);
print "fmt=$fmt >> pr=$pr\n";
$fmt = 'L7';
$pr = unpack($fmt,$data);
print "fmt=$fmt >> pr=$pr\n";
$fmt = 'l7';
$pr = unpack($fmt,$data);
print "fmt=$fmt >> pr=$pr\n";

Thanks.
--
Dick Penny

In reply to UNPACK help plse by dpenny

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.