That point is moot, since the array is lexically scoped
(created via
my()). So a reference to it would
keep it around after it goes out of scope, so modifying it
doesn't really pose a problem.
Incidentally, there's a bit of optimization to be made in
the program:
sub processfile {
my ($file, $list) = @_;
my $script = "/export/home/limo/Perl/exfields.pl -e";
my %hash;
# no need for @list
for my $arg (split /,/ => $list) {
open(FILE, "$script $arg $file |") or die "System error: $!\n";
while (<FILE>) {
# did you mean /^(#|none|unkno)/ ?
next if /^#|none|unkno/i;
chomp;
$hash{$arg} = [split];
# or, if there'll be another $arg of the same value..
# push @{ $hash{$arg} }, split;
}
close FILE;
}
# consider return a REFERENCE to the hash...
# it might be more memory-effective
return %hash;
}
If more description is needed than the comments provide, let
me know.
$_="goto+F.print+chop;\n=yhpaj";F1:eval
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.