in reply to Format question

An approach using format since that's in the title of your question.

#!/usr/bin/env perl use strict; use warnings; my @input = split /\n/, <<EOT; wilma flinstone:3 barney rubble:5 Sam Slate:0 Great Gazoo:2 Charlie Harper:4 Neil Gruesome:6 EOT for my $line (@input) { my @fields = split /:/, $line; format = Customer Name: @<<<<<<<<<<<<<<<<<< Number of Books checked out: @< $fields[0], $field +s[1] . write; }

Consider other options such as Template, printf, Text::Table, etc.