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/add.pl
From PerlNet
Save as scripts/add.pl
#!/usr/bin/perl
use warnings;
use strict;
use lib 'lib';
use AddressBook;
my $ab = AddressBook->new();
my %rec = (
'first' => 'Scott',
'last' => 'Penrose',
'email' => 'scottp@dd.com.au',
'phone' => '1234',
);
my $id = shift;
if ($id) {
my %new = ();
foreach my $d (@ARGV) {
my ($k, $v) = split(/=/, $d, 2);
$new{$k} = $v;
}
} else {
$id = "scottp";
}
$ab->update($id, %rec);
$ab->writedata;

