Jon,thanks a lot for your help :)

Jon Molin wrote:

> Ahmed Moustafa wrote:
> 
>>Hi All,
>>
>>My data structure is a hash of a hash of an array. I build it from an
>>input file by the following code. Could you help me write it back to an
>>output file, please?
>>
>># Code Begins
>>%data = ( );
>>open (IN, "in.txt") || die;
>>while (<IN>) {
>>  chop;
>>  ($user_name, $file_name, $modified_by, $last_modified) = split ( " ",
>>$_ );
>>  $data{$user_name}{$file_name} = [$modified_by, $last_modified];
>>}
>>close (IN);
>># Code Ends
>>
>>
> 
> the hash hasn't got arrays but arrayrefs in it, here are some ways to
> reach the values:
> 
> my $scalar = $data{user}{file1}->[0]; # get value 0 in the file1 array
> my @array = @{$data{user}{file1}}; # dereferens the array and put it in
> @array
> my $array_ptr = $data{user}{file1}; # get the arrayref and reach the
> values by $array_ptr->[nbr]
> 
> /Jon
> 
> 
> 
>>Thanks a lot for your attention. Your help will be appreciated so much.
>>
>>Ahmed
>>
>>--
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to