[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] stupid question about format



<x-flowed>At 17:54 +0100 2/23/99, Vincent Nonnenmacher wrote:
> let say I write :
>
> #!perl
>
> $field1='field1';
> $field2='field2';
> $field3='1';
>
> format STDOUT =
> @<<<<<<<<@>>>>>>>>@>>>
> $field1,$field2,$field3
> .
>
> write;
>
>
> the result is : (^ is space and  is cariage return)
> field1^^^^^^field2Â
>
> I never suceed to get the last field correct if it happen that the
> last field is constitued with spaces like in this script example.

I don't _see_ blanks in your example
> $field1='field1';
> $field2='field2';
> $field3='1';

and my results (MacPerl 5.20r4) (reproduced on Unix Perl 5.005_02) are

field1      field2   1
      ^^^^^^      ^^^
     <--|-->      |-->
field1 is left adjusted in 9 spaces
field2 is right adjusted in 9 spaces
field3 is right-adjusted in 4 spaces
(which is what you asked for).

I don't understand what you want that you aren't getting.

>
> if I try to place the blank inside the write arg list I get the
> same result because perl only see two items in the list.

Can you be more specific about the blanks you say you want?

>
> note : using printf and a C like format work with no problem indeed.

Is there a reason to use format instead of printf?
---
      |\      _,,,---,,_       Vicki Brown <vlb@cfcl.com>
ZZZzz /,`.-'`'    -.  ;-;;,_   Journeyman Sourceror: Scripts & Philtres
     |,4-  ) )-,_. ,\ (  `'-'  P.O. Box 1269  San Bruno  CA  94066
    '---''(_/--'  `-'\_) http://www.cfcl.com/~vlb  http://www.macperl.org

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch

</x-flowed>