in reply to data from one subroutine into a second
Yes.
Have the first subroutine return its data in an array of lines, and then pass that array into the second. like this:
In short, rather than writing data to a file, and parsing it in again, just keep it all in native Perl data structures. Simpler, less work, and a better design because you don't parse.my @results = second_sub(first_sub(@stuff)); # time passes sub first_sub { my @inputs = @_; my @results; # etc return @results; } sub second_sub { my @results; foreach my $line (@_) { # etc } return @results; }
|
|---|