Dual-license your content for inclusion in The Perl 5 Wiki using this HOWTO, or join us for a chat on irc.freenode.net#PerlNet.

Melbourne Perl Mongers/8th March 2006/list.pl

From PerlNet

Jump to: navigation, search

Save as scripts/list.pl


#!/usr/bin/perl
use warnings;
use strict;
use lib 'lib';
use AddressBook;

my $ab = AddressBook->new();
my $search = shift;

foreach my $key (
	$search
	? $ab->search(split(/=/, $search, 2))
	: $ab->list()
) {
	my $entry = $ab->entry($key);

	print join("\t",
		$entry->{last},
		$entry->{first},
		$entry->{email},
	) . "\n";
}

Personal tools