Based on your previous questions1, you are probably talking about threads. As Corion pointed out, Thread::Queue provides queue functionality to threads. According to its documentation (reformatted for brevity):
Any data types supported by threads::shared can be passed via queues:
a) Ordinary scalars, b) Array refs, c) Hash refs, d) Scalar refs, e) Objects based on the above. Ordinary scalars are added to queues as they are.
If not already thread-shared, the other complex data types will be cloned (recursively, if needed, …
Your question here is very vague (please read How do I post a question effectively?), but taking your meaning of "two dimensional queues" as literally as I can, I believe a simple anonymous array ref (constructed with [ ... ]) would work for you. Something like this:
use Thread::Queue;
my $q = Thread::Queue->new;
# Later, in producer thread(s) ($first and $second
# represent the 2 dimensional tuple you wish to enqueue)
$q->enqueue( [ $first, $second ] ); # Anonymous array ref
# Later still, to signal the end of all elements:
$q->enqueue(undef);
# In the consumer thread(s):
while (defined (my $ref = $q->dequeue)) {
my ($first, $second) = @$ref; # Dereference array
# ... Process $first and $second
}
That's pretty much the pattern. You should be able to easily adapt it to your needs. If not, write up a better description of what you need, and we'll help you from there.
____________
1. meena's recent threads: Create your own signal in Perl, Alarm In Perl
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.