I have an array which contains the entries below - the output was generated
with the following loop:
for $r ( 0 .. $#allfilesystems ) {
for $c ( 0 .. $#{ $allfilesystems[$r] } ) {
print "elt $r $c is
$allfilesystems[$r][$c]\n";
}
print"\n";
}
OUTPUT:
elt 0 0 is sd
elt 0 1 is appsdg_CA-01
elt 0 2 is dmdcapps_archive-01
elt 0 3 is appsdg_CA
elt 0 4 is HDS99600_18
elt 1 0 is sd
elt 1 1 is appsdg_CB-01
elt 1 2 is dmdcapps_archive-01
elt 1 3 is appsdg_CB
elt 1 4 is HDS99600_17
elt 29 0 is sd
elt 29 1 is oradg_C9-09
elt 29 2 is roll02-01
elt 29 3 is oradg_C9
elt 29 4 is HDS99600_19
elt 30 0 is sd
elt 30 1 is oradg_C9-10
elt 30 2 is arch01-01
elt 30 3 is oradg_C9
elt 30 4 is HDS99600_19
What I need to do is to compare the user input with each of the entries in
my array. For instance, if the user enters roll02 - the whole row
containing roll02 must be printed.
yanet@myhost#getinfo.pl roll02
Filesystem Information:
Disk_Type: sd
Disk_Name: oradg_C9-09
Plex_Name: roll02-01
Disk_VolName: oradg_C9
Device_Number: HDS99600_19
The above is the ideal output. However, I have had trouble comparing my
user output with each of the elements of my array. The following was
attempted but, it doesn't work:
for $r ( 0 .. $#allfilesystems ) {
for $c ( 0 .. $#{ $allfilesystems[$r] } ) {
print "$allfilesystems[$r][$c]\n" if $allfilesystems[$r][$c]
=~ /$userinput/i;
}
print"\n";
}
OUTPUT:
Use of uninitialized value at ./vxprint2.pl line 29.
sd
Use of uninitialized value at ./vxprint2.pl line 29.
oradg_C9-10
Use of uninitialized value at ./vxprint2.pl line 29.
arch01-01
Use of uninitialized value at ./vxprint2.pl line 29.
oradg_C9
Use of uninitialized value at ./vxprint2.pl line 29.
HDS99600_19
I know that the above is supposed to print only the entry, WHICH CONTAINS
THE USER INPUT but I want all the entries in the corresponding row. How may
accomplish this?? My attempt is not even doing the minimum. Any
suggestions???
Thank you!!!
Yanet
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]