The only thing I would add, to yours and BrowserUk's solutions, would be to add an eventloop system in your main program, which can utilize timers to check shared variables on a regular schedule, and do what needs to be done.

This is completely and utterly useless advice. There is absolutely no advantage to using an event loop in the main thread for this.

If there was a requirement to "have the timer in the main program loop do periodic checking of the hash.", that is trivial:

my @maclist = qw ( 7D:6D:62:C6:B4:3D 01:12:79:3E:14:2E 80:27:E4:EA:60:74 E8:06:88:7F:8C:83 01:26:08:E8:B6:5D 34:15:9E:5D:E6:49 03:1E:64:CE:25:88 01:0C:29:3F:67:1B 01:22:69:76:5D:F4 64:B9:E8:10:BF:20 01:1D:FE:D4:7F:E0 ); my @threads; foreach my $mac (@maclist){ push @threads, threads->create( \&doit, $mac ); } while( sleep 1 ) { ## check %clients and do things. } $_->join for @threads;

Recommending the addition of huge, monocultural behemoths like POE or GTK2+glib solely to respond to artificial events generated by a timer is asinine. Like hiring a chainsaw to trim your toenails.

You seem to be suffering from the 'When you have a lumphammer' syndrome.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

In reply to Re^2: Should I use threads? Perl/DHCP/Radius by BrowserUk
in thread Should I use threads? Perl/DHCP/Radius by Anonymous Monk

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.