in reply to I am designing a logic simulator but stuck.

wee -- that's a lot of code to look at ;)

have you used strict & warnings ?

But after a quick glance, this

$mystring= @raw_data[$a];

might not be doing what you think it does.

To access an element in a list try

my $str = $raw_data[$a];

As you're just starting out, you may find the articles in the Tutorials section useful :)