in reply to Re: Jabber MUC bot channel list problem.
in thread Jabber MUC bot channel list problem.
Hi,
Thank you for your reply. The one thing I cannot imagine a bit is how do I use this hash to store users. How do I add user to that hash ? If $jid is a key, then each key ($jid) must have a value. What is that value ? Anything ? Also I created some test script which checks your way of thinking.
Please take a look:
Why the last if doesn't print "something" if the key exists ?#!/usr/bin/perl use Data::Dumper; my %roster; @jid= qw |test1 test2 test3 test4|; foreach $jid (@jid) { $roster{$jid} = "0"; } foreach $jid (@jid) { print Dumper ($roster{$jid}); } @keys = keys %roster; print "Keys: @keys\n"; $jid = "test1"; if ($roster{$jid}) { print "something"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Jabber MUC bot channel list problem.
by oxone (Friar) on May 25, 2011 at 21:59 UTC | |
by Jarek (Novice) on May 27, 2011 at 08:33 UTC |