Octavian has asked for the wisdom of the Perl Monks concerning the following question:
Any help or ideas would be greatly appreciated...and if there is another way to get the formulas AND the end result, that would work, but I would prefer to find a nifty perly way to do it :)#!/usr/local/bin/perl chomp(@datafile = `/usr/sbin/kmtune -S /stand/system`); foreach (@datafile) { tr/[A-Z]/[a-z]/; ($key,$value) = split(/\s+/); if ($key eq "Parameter" || $value eq "") { next; } if (grep/^0x/i,$value) { $value = hex($value); } $var{$key} = $value; } foreach $key(keys %var) { ### Evaluating the hash variable generates errors on the ones that hav +e varibales embedded in them. #print "$key:", eval $var{$key}, "\n"; ### This works, but doesnt resolve formulas in the variables. print "$key:", $var{$key}, "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: resolving variable names within variable names.
by jeffa (Bishop) on Jun 04, 2002 at 15:43 UTC | |
by Octavian (Monk) on Jun 04, 2002 at 16:29 UTC | |
|
Re: resolving variable names within variable names.
by Octavian (Monk) on Jun 04, 2002 at 14:58 UTC |