#!/usr/bin/env perl use 5.010; use warnings; use strict; my $max_width = 60; my $scale = '1.......10........20........30........40........50........60'; my $long_string = q{The quick brown fox jumps over the lazy dog}; my $pat = "%.2f %d/%d/%d %-.*s|\n"; my @aoa = ( [ qw/79.3 2022 1 8 43/, $long_string ], [ qw/394571 22 10 81 39/, $long_string ], [ qw/123456.78 12345 123 1234 33/, $long_string ], # compute ^^ as (60 - pos) ); say $scale; for my $aref (@aoa) { printf( $pat, @$aref ); }