dra*_*tun 13
我似乎在多年前使用Fortran时会想起类似的东西(但它很可能是第三方库).
至于Perl中的其他选项,请看一下Perl6::Form.
该form函数替换format为Perl6." Perl最佳实践 "中的Damian Conway 建议使用Perl6::FormPerl5引用以下问题format....
以下是Perl6::FormRobert Gamble的Ruby示例的变体....
use Perl6::Form;
my ( $month, $day, $year ) = qw'Sep 18 2001';
my ( $num, $numb, $location, $toe_size );
for ( "Market", "Home", "Eating Roast Beef", "Having None", "On the way home" ) {
    push @$numb,     ++$num;
    push @$location, $_;
    push @$toe_size, $num * 3.5;
}
print form 
    '   Piggy Locations for {>>>}{>>}, {<<<<}',
                          $month, $day, $year ,
    "",
    '  Number: location              toe size',
    '  --------------------------------------',
    '{]})      {[[[[[[[[[[[[[[[}       {].0} ',
     $numb,    $location,              $toe_size;
FormatR为Ruby提供类似Perl的格式.
以下是文档中的示例:
require "formatr"
include FormatR
top_ex = <<DOT
   Piggy Locations for @<< @#, @###
                     month, day, year
Number: location              toe size
-------------------------------------------
DOT
ex = <<TOD
@)      @<<<<<<<<<<<<<<<<       @#.##
num,    location,             toe_size
TOD
body_fmt = Format.new (top_ex, ex)
body_fmt.setPageLength(10)
num = 1
month = "Sep"
day = 18
year = 2001
["Market", "Home", "Eating Roast Beef", "Having None", "On the way home"].each {|location|
    toe_size = (num * 3.5)
    body_fmt.printFormat(binding)
    num += 1
}
哪个产生:
   Piggy Locations for Sep 18, 2001
Number: location              toe size
-------------------------------------------
1)      Market                   3.50
2)      Home                     7.00
3)      Eating Roast Beef       10.50
4)      Having None             14.00
5)      On the way home         17.50