Praise to Damian for Exegesis 7: the new formats sound very well-thought-out, flexible, easy-to-use, and extensive -- as well as being implemented and available right now. I've never used formats in Perl 5, but I could see myself using Perl6::Form.
Thank-you.
I have a few questions. Unfortunately I'm only running Perl 5.6.1 here so can't easily try out Perl6::Form and try to work out the answers from that. I've split them into separate mails so that they can have distinct subjects, in the hope that'll be easier for people (and Piers in particular). This one's about thousands separators.
Pretty much any character can be used as a decimal point or as a thousands separator. All the examples show using either just a decimal point or using both of them; having just a thousands separator is not demonstrated. Is that possible? For example taking this data:
@num = (72, 25783, 1000);
and wanting to produce:
72 25,783 1,000
Perhaps this works:
print form '{>>,>>>}', @num;
But it's very similar to this:
print form '{>>,<<<}', @num;
which treats the comma as a decimal point and therefore would yield:
72,0 ##,#### ##,####
Is the justification of the digits after the comma enough to be unambiguous about what is meant? And even if it is, is it sufficiently unconfusing for humans having to use it? Accidentally writing one of the above when meaning the other one could be easy to do and hard to spot.
At the moment, the implementation requires numeric fields to have a decimal marker of some kind. I can see the need for this kind of field, so I'll think about whether it can easily be implemnented. And won't be too error-prone.
Along similar lines, is it possible to have thousands separators after the decimal point? For example to get output like this:
0.045 323 0.032 200 0.103 382
Would this format work?
print form '{>.<<< <<0}', @small_num;
It isn't present in the implementation, but it's a very useful idea that I'll add.
Thanks for the excellent suggestions.
Damian