Coder's Guild Mailing List

Perl question

Posted by Frank Hale on 1999-05-01

I want to store binary numbers in an array. But when I access the array
to print it off it prints garbage.

#!/usr/bin/perl

@binary_data;

push (@binary_data, \x01);  # element 0
push (@binary_data, \x02);  # element 1
push (@binary_data, \x03);  # element 2

print "number of elements = $#binary_data\n";

foreach $element (@binary_data)
{
    print $element."\n";
}

Output:

number of elements = 2
SCALAR(0x80bf9c0)
SCALAR(0x80bf9f0)
SCALAR(0x80bfa20)

How can I get it to print the correct values for the elements?

-- 
From:      Frank Hale
Email:     frankhale@xxxxxxxx.xxx.xxx
ICQ:       7205161
Website:   http://www.franksstuff.com (DOWN FOR A WHILE)