Simple Address Book Manager
Build an address book that runs in the terminal, written in Perl: add contacts with a name, phone number and email, search them by any part of the name, list them in alphabetical order, edit and delete them, all from a simple menu. Contacts are saved in a plain text file, one per line with fields separated by tabs, so they're still there next time. Phone numbers and emails are checked with regular expressions before saving. It's a great first Perl project: you'll learn subroutines, arrays of hashes, reading and writing files, regular expressions for validation, sorting, and a menu loop that reads user input.
- Estimate
- ~6h
- Steps
- 5
- Completed by
- 0
- Proposed by
- codeseed.app
Perl core modules
Project roadmap
- 01
Choose the storage format
~0.5hWrite README.md describing the file format (one contact per line: name, phone and email separated by tabs, with tabs and line breaks removed from values before saving) and the menu options (add, search, list, edit, delete and quit). Done when: README.md describes the format and menu.
- 02
Load and save contacts
~1.5hWrite load_contacts, which reads the file (if it exists) into an array of hashes with name, phone and email, skipping and reporting malformed lines, and save_contacts, which writes them back, first to a temporary file and then renaming it so a crash can't corrupt the address book. Use strict and warnings. Done when: contacts saved by one run are loaded by the next.
- 03
Build the menu
~1.5hWrite a loop that prints the menu, reads a choice with <STDIN> (removing the newline with chomp), and calls a subroutine for each option: add, search (case-insensitive, by part of the name), list (sorted by name with printf in aligned columns), edit and delete (choosing the contact by its number, and asking to confirm deletion). Save after every change. Done when: every menu option works.
- 04
Validate input
~1hCheck with regular expressions that the name isn't empty, the phone number contains only digits, spaces, +, - and parentheses with at least 7 digits, and the email looks like name@domain.tld. Ask again when a value is invalid, explaining what's wrong. Warn when adding a contact with a name that already exists. Done when: invalid values are refused with clear messages.
- 05
Test the whole flow
~1.5hMove the logic into subroutines that don't read the keyboard, and write tests with Test::More using a temporary file: loading and saving, adding with valid and invalid values, searching, sorting and deleting. Then test by hand that changes persist between runs. Done when: prove passes, and the manual check works.
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack