in reply to What's wrong with my syntax?

A couple things spring to mind

  1. It looks like you're using local when you mean to be using my.
  2. You are declaring @name as local within the for block - so when you exit the for block it goes away. What you need to do is declare it outside the for block so that it's available throughout your entire sub. See below:
sub nameimport { my (@name, @version); foreach (@_) { if (/hostname/) { @name = split(/ /); } elsif (/version/) { @version = split(/ /); }; }; #blah, blah, blah, do stuff... }