[...] %roster = $Connection->RosterGet(); Roster('list'); sub Roster { my $action = shift; my @info; if ($action eq "list") { print "===> Roster for $username\@$server\n"; for my $contact ( keys %roster ) { print " $contact:\n"; for my $info (keys %{$roster{$contact}}) { if ($info eq "groups") { # groups needs special care print "\tgroups= $roster{$contact}{$info} \#\#Fix Me!\n"; } else { print "\t$info= $roster{$contact}{$info}\n"; } } } } elsif ($action eq "add") { warn "Not implemented yet.\n"; } elsif ($action eq "remove") { warn "Not implemented yet.\n"; } else { warn "Roster():\'$action\', no such action.\n"; } }