http://www.perlmonks.org?node_id=314575

spudnic has asked for the wisdom of the Perl Monks concerning the following question:

Greetings,

I'm having a problem using formats. The issue arises when the variable that is to be printed last in a line contains only spaces nothing is added to the end of the line. This variable on most rows will be something other than all spaces or it wouldn't be a problem. I must have these spaces as they are required for the parser to find something in those columns.

Example:

#!/usr/bin/perl # This script is called format_test format = @<<<<@>>> $field1,$field2 . $field1 = "Hello"; $field2 = " "; write;
When you run
./format_test | wc -m
you get 6.

The parser freaks out if there is anything after where I need the spaces, so I can't force padding by sticking something in the next field.

Any suggestions? The parser is an old mainframe job, so getting it modified would be a big pain.

Thanks