in reply to Re: Re: Searching data file
in thread Searching data file

Yes you are right, there is a problem that my code does not pick out multiple authors. I have omitted multiple authors for being lazy.

Fixing the code is simple though, just modify the code slightly to read multiple authors (same as multiple keys).
my @author = $rec =~ m/<key>\s*([^<]*)(?=<)/g; $col{author} = \@author;
And how to store the returned hash structure by the subroutine needs to be revised too since there can be multiple authors. That should be a simple exercise.

Replies are listed 'Best First'.
Re: Re: Re: Re: Searching data file
by Anonymous Monk on Nov 03, 2003 at 09:32 UTC
    If you wanted to use the hash again in another program (ie. save the data as a hash in a file for future use) -- how do you get the data to be 'loaded' in the new program so that you could use the statement below? $myinfo = $records{'Sydney'}{'Title'}; I looked on the web and everyone is using the 'eval' function but there are no good examples.