Subject: How to read this array?

I have this array and I am trying to figure out how to read $id  in it.  Any
ideas?

@history = (
  {
    program => 'racer',
    version => '0.45',
    input => {
      '/home/' => undef,
    },
    input_contents => '
      $name    = \'Jerry\';
      $id      = \'035\';
      1;
    ',
    perl => {
      location => '/home/',
      version => 5.00502
    }
  }
);

Thanks,

Jerry

I'm not sure why you have this in an array... when 
%history = (program=>'racer',
        version=>'0.45',
        input_contents=>'...',
        perl=>{location=>'/home/',
                version=>5.00502
                },
        );
would do the same thing...
plus %history{input_content} is a string the way you have it coded... 
so...
my %temp = split /=>|;/, %history{input_content};
#turn into a hash ... 
$temp{'$id'} = "your value" # to change or add to hash
then turn hash back into a string...
$history{input_content = '';
$history{input_content} .= sprintf ('%s = %s;', $_, $temp{$_}) foreach (keys
%temp);
# note that key "1" has a null values 
hope this gives you some ideas...

jwm


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to