in reply to whats wrong with my sub-routine ??

$terminal has nothing to do with $terminal[0], something use strict would have caught.

Perhaps you meant $terminal->[0]?

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.