[TriLUG] perl programming question
John F Davis
johndavi at us.ibm.com
Thu Mar 21 09:49:39 EST 2002
Hello
I have a simple perl problem for those of you who know perl.
I have a hash table which contains info based upon keys which are
partitions.
$partHash{"/dev/hde1"} = "some info (partition type amongst other things."
Later, I am in a loop where I have a $drive variable which contains
"/dev/hde" and
I want to get access to variables in the hash table.
ie.
for ($i=0, $i < $numOfPartitions; $i++) {
#cylinder info is manipulated and not needed for this example
print "$begCyl, $endCyl, $partHash("$drive$i"), $boot \n";
}
However, this bit doesn't work. $drive$i fails miserably. If it was
bash, I would do ${drive}$i, but that doesn't work either.
JD
More information about the TriLUG
mailing list