Douglas is correct but you also might find it useful to use a foreach loop to get the octets displayed. I'm not 100% sure that while loop will work.
Something like:
foreach my $octet (@octets) { print qq(Octet = $octet\n); }
instead of
while (@octets) { print qq(Octet = $_); }
Cheers,
Mat