in reply to Re^3: Perl variable scoping between functions
in thread Perl variable scoping between functions
In the scope of this, when you call the sub via my @other = fLoadModules($modules); it will try to open the array count instead of the file. This had come up in my previous investigation/testing before I turned to the good people of perl monks for answers.sub fLoadModules { my ($modules) = @_; my @array; open my $fh, "<", $modules or die "Couldn't open module file: $mod +ules"; while(<$fh>) { chomp; my ($module_id) = split /;/; push @array, $module_id; } close $fh; return @array; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Perl variable scoping between functions
by Corion (Patriarch) on Jul 18, 2018 at 12:07 UTC | |
by Bryan882 (Novice) on Jul 18, 2018 at 12:43 UTC |