[TriLUG] perl programming question

John F Davis johndavi at us.ibm.com
Thu Mar 21 09:55:00 EST 2002


nevermind,

$driveKey = $drive . $i; did the trick.

John F Davis/Raleigh/IBM at ibmus@trilug.org on 03/21/2002 09:49:39 AM

Please respond to trilug at trilug.org

Sent by:    trilug-admin at trilug.org


To:    trilug at trilug.org
cc:
Subject:    [TriLUG] perl programming question



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

_______________________________________________
TriLUG mailing list
    http://www.trilug.org/mailman/listinfo/trilug
TriLUG Organizational FAQ:
    http://www.trilug.org/~lovelace/faq/TriLUG-faq.html





More information about the TriLUG mailing list