Thanks you very much, I work with raw binary data and your code -modified according your last remark- returns me exactly what I wanted.
I am writing PERL scripts (big ones) since years in order to help me in my daily work as Head of NOC. I spent 4 hours this morning to NOT understand your code (the 1st one), I gave up I tryed the second one with immediate succes (in results, not in understanding) .
I thought I "can" write PERL, now I am really down and full of doubts.