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>
In reply to Returning a list from a sub by coec
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |