in reply to Subroutine question

The other posters already indicate that passing these items as arguments to your subroutine would be the best way to handle it, but I'm looking at your subroutine and wondering what you're trying to do. Just FYI, <FILE> works line-by-line, so you shouldn't have to split on \n. You could re-write your function like this:
sub file_processing { my ($script, $arg, $file) = @_; my @ret; open(FILE, "$script $arg $file |") or die "can't do it: $!"; while (<FILE>) { chomp; next if /^#|none|unkno/i; push(@ret, $_); } close(FILE); return @ret; }
Note also that your open call is going to be insecure if any of your 3 arguments is provided by the user. You probably want to do something like this for better security, unless you know you can trust all three arguments. Running Perl with taint-checking (-T) enabled helps if you're dealing with potentially bad/mischievous data.
my $pid = open(FILE, "-|"); if (!$pid) { die "Couldn't fork: $!" unless defined $pid; exec($script, $arg, $file) or die "Couldn't exec: $!"; }
This has the same effect, but instead of passing the command to /bin/sh (or whatever your shell is) to parse into a command and arguments (which might include things like semi-colons allowing an evil person to execute other programs), it uses exec to forcibly pass things as discrete, known arguments directly to the script.