Okay, here goes...

First off, you would really benefit from use strict. I know that gets said a lot around here, but it's also true. You appear to be using symbolic references (i.e. terms such as ${$locationold}{online}++ in this context), also Not a Good Thing, since apart from anything else they're easily mistaken for hard refs, and it's not obvious what they're pointing to unless you're very careful.

I've not dug into the code perhaps as far as I should, but a couple of things stand out. The $place and $title variables are used only once, suggesting a typo (use strict helps here. Really. It saves me on a daily basis). Also, I'm not sure about what you're splitting on. You say it should be '|+|', but your first split is using 'x' as the delimiter.

There may be fundamental misconceptions in the rest of the code, or it may well be fine. I suppose I might be inclined to use separate %exists hashes for each set of terms you're using it for, in case of overlap (unlikely, but not impossible). I may also have seriously misunderstood something :-)

Anyway, hopefully this will give you a start. Good hunting,

Tim

Update: I just realised, the line $line="$ipx$timex$placex$title"; probably won't work either, because you don't have variables named $ipx, $timex, $placex etc. Writing it

$line=$ip."x".$time."x".$place."x".$title;
would be better. Especially if you had variables named $place and $title ;-)

In reply to Re: ForEach Command struggle.. by tfrayner
in thread ForEach Command struggle.. by Kage

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.