#!/usr/bin/env perl use strict; use warnings; use autodie; use PM::FixedWidthFile qw{populate_file}; my $fixed_width_file_base = './pm_fixed_width_file.out_'; my $record_length = 32; # not including line terminator my @multi_file_data = ( [ [ [10, ''], [10, 123], [10, 456] ], ], [ [ [10, ''], [10, 123], [10, 456] ], [ [10, ''], [10, 123, 1], [10, 456] ], [ [10, ''], [10, 123], [10, 456], [2, 78] ], ], [ [ [10, ''], [10, 123], [10, 456], [2, 78] ], [ [10, ''], [10, 123], [10, 456], [2, 789] ], ], ); for my $i (0 .. $#multi_file_data) { my $outfile = $fixed_width_file_base . $i; print "Populating: $outfile\n"; open my $fh, '>', $outfile; populate_file($fh, $record_length, $multi_file_data[$i]); close $fh; system qw{cat -vet}, $outfile; unlink $outfile; # my housekeeping }