Hi BrowserUK and thank you for your fast answer :-)

Here is my code for the file creation.

open(OUT,'>'.$fil) or die $!; binmode OUT; for $i(1 .. 10000){ $lat=int(rand(20000))+440000; $lon=int(rand(10000))+20000; $typ=chr(31); $cod=pack('l>l>C',$lat,$lon,$typ); print OUT $cod; } close(OUT);
And here is my code for the read and comparison:

$lah=pack('l>',$lah); $lab=pack('l>',$lab); $loh=pack('l>',$loh); $lob=pack('l>',$lob); open(IN,"<ch"; @fil=stat(IN); $num=$fil[7]/9; binmode(IN); for(1 .. $num){ read(IN,$lat,4); read(IN,$lon,4); read(IN,$pyt,1); if(($lat lt $lah) && ($lat gt $lab) && ($lon lt $loh) && ($lon gt $lo +b)){ print "OK"; } }

But it is never OK :-(


In reply to Re^2: comparison of packed signed integers by gerleu
in thread comparison of packed signed integers by gerleu

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.