Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Re: How to Tie Existing File to Hash

Reply
Thread Tools

Re: How to Tie Existing File to Hash

 
 
SpecialK
Guest
Posts: n/a
 
      02-20-2004
I have a 150k line file that I am trying to convert to a hash.
Each line has a number, e.g. first line has 50000000, last line has 50149999
The message I get is basically, I am running of shared memory.
Here is the code:


use IPC::Shareable;
%ShmOptions = ('create' =>1, 'exclusive' =>0, 'mode' =>0666, 'destroy'
=>0);
eval {tie(%hashofGuids, 'IPC::Shareable', 'hashguid', %ShmOptions}) };
my guidfile ='/home/gregk/www/guid_excluded.dat';

open(GUIDS, guidfile) or die "couldn't open file: $!";
(tied %hashofGuids)->shlock;
while(<GUIDS>)
{
chomp($eachline = $_;
$hashofGuids{$eachline} = 1;
}
(tied %hashofGuids)->shunlock;
## At this point I get the running out of shared memory message ###

I tried used size=>xxx in the %ShmOptions statement but I get an invalid
size error message.

I am open to any suggestions,

thanx,
greg



"WC -Sx- Jones" < > wrote in
message news:...
> SpecialK wrote:
> > Does anyone know how to tie a large existing file(each record is a 8byte
> > number) to a Hash using IPC::Shareable?
> > Any Code fragments would be most helpful.

>
> Why doesnt:
>
> http://search.cpan.org/~bsugars/IPC-...C/Shareable.pm
>
> Address your question?
> -Sx-
>
> PS - See also:
> http://london.pm.org/pipermail/londo...18/020948.html

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hash of hash of hash of hash in c++ rp C++ 1 11-10-2011 04:45 PM
Dumping Perl tie hash file Eric Perl Misc 6 03-10-2007 06:37 PM
tie() with DB_File not tie()ing ? botfood Perl Misc 23 04-26-2006 01:59 AM
Tie a file to a hash SpecialK Perl 1 02-19-2004 07:04 PM
Tie a large file to a Hash SpecialK Perl 0 02-19-2004 05:28 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57