Hey Kage we spoke yesterday on the Chatterbox, and I downloaded and attempted to debug your code. first off there are several statements like this:
${$locationold}{online}++;

doesn't $locationold contain a url string? Why are we dereferencing it? I'm really confused by this. If you're not an expert perl programmer, I think you are overcomplicating things.

also you need to read the perlopentut man page. In this script you try to open variables that haven't been initialized that can clobber you script, and your opens should really be followed by an or die() for this reason. The param function from CGI.pm is defined but never used... You use the same filehandle over and over through different opens, which is a Bad Thing.

Anyway, I applaud your effort, but I suggest in the future, when posting here, you add comments to your script before every major block explaining what you want to do. Indent your loops, and explain what errors the interpreter gave you. There are a lot of people on this site, who are much better programmers than me, and very helpful people to boot, but neither they nor i can help much if we cant understand what you are trying to do.

Fun fact:

foreach $loctitle (@titleb){ $online++; }
is better written as:
$online += @titleb;

In reply to Re: ForEach Command struggle.. by thunders
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.