sub file_processing { my ($array_ref, $script, $arg, $file) = @_; open(FILE, $script . ' ' . $arg . ' ' . $file . ' |') or die ("can't do it: $!\n"); while () { chomp; next if /^\#/; next if /none/i; next if /unkno/i; push @{$array_ref}, split ( /\n/, $_); } close FILE; } #### &file_processing(\@array1, $script1, $arg1, $file1); &file_processing(\@array1, $script2, $arg2, $file2);