sub file_processing { my( $arg, $file)= @_; # added my @array; # added $script = "/export/home/ssesar/Perl/another_script.pl -e"; $open = "$script $arg $file"; # changed open(FILE, "$open |") or die "can't do it\n";# changed while () { # changed chomp; next if /^\#/; next if /None/; next if /Unkno/; next if /unkno/; next if /NONE/; @_ = split ( /\n/, $_); @array = @_; } close FILE; return @array; # added }