[TriLUG] perl programming question

Andrew Perrin andrew_perrin at unc.edu
Thu Mar 21 10:05:56 EST 2002


And, red-faced, I was wrong; hash lookups don't double quote.  So you can
use your $driveKey hack, or alternatively:

print "$begCyl, $endCyl, $partHash{qq{$drive$i}}, $boot \n";

ap

----------------------------------------------------------------------
Andrew J Perrin - andrew_perrin at unc.edu - http://www.unc.edu/~aperrin
 Assistant Professor of Sociology, U of North Carolina, Chapel Hill
      269 Hamilton Hall, CB#3210, Chapel Hill, NC 27599-3210 USA


On Thu, 21 Mar 2002, John F Davis wrote:

> 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
> 
> 
> _______________________________________________
> 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