in reply to Re: Returning a list from a sub
in thread Returning a list from a sub
I that the above is wrong (because it doesn't work, read as: doesn't do what I want).sub TSM_Enquire { my $Slot, $Type, $Label; open(IN,"/bbs/rtscripts/adsm_cmd q libv|"); while (<IN>) { next unless (/3584/); s/,//; @Fields = split ' '; $Label = $Fields[2]; $Slot = $Fields[$#Fields-1]; $Type = $Fields[3]; push @List, "$Slot $Type $Label"; } close(IN); return @List; } sub Process_Columns { my $Count=0; my $Simple; my @Column_Info = ( [ 1024, 1067 ], # Column 1 start stop [ 1068, 1093 ], # Column 2 start stop [ 1094, 1137 ], # Column 3 start stop [ 1138, 1163 ], # Column 4 start stop [ 1164, 1207 ], # Column 5 start stop [ 1208, 1233 ], # Column 6 start stop [ 1234, 1277 ], # Column 7 start stop [ 1278, 1321 ] ); # Column 8 start stop if ($LibraryType =~ "tsm") { @List = TSM_Enquire; } else { @List = Tapeutil_Enquire; } for ($Count=1;$Count<=8;$Count++) { # Traverse columns my $StartPos = $Column_Info[$Count][1]; my $Pos = $StartPos; my $Column_Count = 0; my $EndPos = $Column_Info[$Count][2]; my $NewPos=0; my $NewLabel=""; my $NewRec=""; while ($NewRec = @List) { chomp $NewRec; $NewRec =~ s/^ //; ($Pos, $Type, $Label) = split(' ', $NewRec, 9999); for ($I=1;$I<=($EndPos-$StartPos)+1;$I++) { <snip>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Returning a list from a sub
by seattlejohn (Deacon) on Jul 24, 2002 at 05:28 UTC |