[TriLUG] perl programming question
Benjamin Reed
ranger at befunk.com
Thu Mar 21 09:57:36 EST 2002
John F Davis [johndavi at us.ibm.com] wrote:
> 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.
It should be in curly braces, not parens, and your quoting is going to
confuse it (you're closing the quote at the beginning of the print statement
with the one inside %partHash). You'll probably have to do something like:
print "$begCyl, $endCyl, " . $partHash{"$drive$i"} . ", $boot \n";
--
Benjamin Reed a.k.a. Ranger Rick (ranger at befunk.com) http://ranger.befunk.com/
Boy is it cramped... whoooee! I tell ya, if I was dead, you most certainly
could NOT swing me around in HERE. -- Cat
More information about the TriLUG
mailing list