http://qs1969.pair.com?node_id=558471

abachus has asked for the wisdom of the Perl Monks concerning the following question:

Good day/night all,

Another simple question of many i seem to bring, i was wondering if you might be able to help me with this thing :

while($data){ $output=substr(0,8,''); print $output; }

The above code appears to work for me, and i even think i understand it, well i'd appreciate if you could point out if i'm wrong, or better still advise a better way of seperating the data.

1. While $data is true, that is while it contains bytes, except if there remains one byte that happens to be zero(0), in which case its false. To get around that could be :

while(length($data) > 0){;}

2. $output is filled with the first 8 bytes of data, with the substr() function and those bytes within $data are replaced with (no data), thus $data is reduced in size by indeed 8 bytes. Prints $output illustration purposes obviously.

thanks again,

Isaac.