I'm finding when the hash gets to be more than 27,000, I get the out-of-memory error.

hum, that's really not that big. Especially if it just hold URLs. You should see the following surpass that number in no time.

my $i; my %urls; for (;;) ++$url{"http://www.perlmonks.org/?node_id=".++$i}; print("$i\n") if $i % 1000 == 0; }

Tie a shoelace around a shoebox and wave a magic wand over it.

Actually, that's quite an apt description!

tie is a form of magic (yes, that's really what it's called) that ties methods to a variable (shoebox) such that those functions are called in response to the different actions taken on that variable. For example, $tied = $x; calls the tied variable's STORE method.

It's easier to understand if you look at it from the other end. tie allows a module to use a Perl variable as its interface. Instead of $obj->store($x), it allows $obj = $x;.


In reply to Re: Another "out of memory!" problem by ikegami
in thread Another "out of memory!" problem by slugger415

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.