Limo has asked for the wisdom of the Perl Monks concerning the following question:
I'd like to know if I could replace:sub file_processing { $script = "/export/home/ssesar/Perl/another_script.pl -e"; $open = "$script $arg1 $file1"; open(FILE1, "$open |") or die "can't do it\n"; while (<FILE1>) { chomp; next if /^\#/; next if /None/; next if /Unkno/; next if /unkno/; next if /NONE/; @_ = split ( /\n/, $_); @array1 = @_; } close FILE1; }
with:$open = "$script $arg1 $file1"; open(FILE1, "$open |") or die "can't do it\n";
and:$open = "$script $arg2 $file2"; open(FILE2, "$open |") or die "can't do it\n";
with:@array1 = @_;
...within the same subroutine. Not a whole lot to re-type, if I needed to create 2 different subroutines, but I'd like to learn to program as efficiently as possible.@array2 = @_;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Subroutine question
by Fastolfe (Vicar) on Sep 18, 2000 at 22:25 UTC | |
|
RE: Subroutine question
by reyjrar (Hermit) on Sep 18, 2000 at 22:07 UTC | |
by BlaisePascal (Monk) on Sep 18, 2000 at 22:14 UTC | |
|
Re: Subroutine question
by mirod (Canon) on Sep 18, 2000 at 22:10 UTC | |
|
Re: Subroutine question
by cwest (Friar) on Sep 18, 2000 at 22:06 UTC | |
by jreades (Friar) on Sep 18, 2000 at 22:29 UTC | |
by Limo (Scribe) on Sep 18, 2000 at 22:24 UTC | |
by jreades (Friar) on Sep 21, 2000 at 07:49 UTC |