in reply to File Formatting - Help required

use strict; use warnings; open(A,">Result.txt") or die "$!"; while(<DATA>) { printf A "%-10s%-7s%-8s\n",split } close(A) __DATA__ The Early Year Five New Swine
Update: The default arguments to split are sufficient: split $_ around whitespace.

The format string (first argument) to printf is as follows:
% indicates the start of a format specifier, a value which follows the format string will be "plugged-in" and formatted into this position.
- means left justify the field
10 (or 7 or 8) is the minimum field width. Shorter fields will be padded with spaces, longer will be displayed intact (data will not be lost).
s indicates the field is a string