coec has asked for the wisdom of the Perl Monks concerning the following question:
In the following sub, I want to return the list @List to the calling sub. How do I do this?
"adsm_cmd q libv|grep 3584" returnssub TSM_Enquire { my $Record, $Slot, $Type, $Label; my @List; open(IN,"adsm_cmd q libv|grep 3584|"); open(OUT,">/tmp/show_library.$$"); while ($Record = <IN>) { $Record =~ s/,//; @Fields = split(' ', $Record, 9999); $Lable = $Fields[$#Fields-1] $Slot = $Fields[2]; push(@List, $Slot . " " $Type . " " . $Lable); } close(IN); close(OUT); }
To finish up, I want to return the list containing slot, type and label to the calling function and the the calling function needs to loop through the list and take various actions depneding on the slot range and type.<snip> 3584LIB1 922ABL Private Data 1,036 3584LIB1 923ABL Scratch 1,100 3584LIB1 924ABL Private Data 1,076 3584LIB1 925ABL Private Data 1,030 3584LIB1 926ABL Private Data 1,078 3584LIB1 938ABL Private Data 1,025 3584LIB1 939ABL Private Data 1,037 3584LIB1 CLNI88 Cleaner 1,026 3584LIB1 CLNI89 Cleaner 1,038 </snip>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Returning a list from a sub
by VSarkiss (Monsignor) on Jul 24, 2002 at 03:00 UTC | |
|
Re: Returning a list from a sub
by zejames (Hermit) on Jul 24, 2002 at 03:34 UTC | |
by coec (Chaplain) on Jul 24, 2002 at 04:16 UTC | |
by seattlejohn (Deacon) on Jul 24, 2002 at 05:28 UTC | |
|
Re: Returning a list from a sub
by sauoq (Abbot) on Jul 24, 2002 at 03:56 UTC |