lhp@nereida:~/Lperl/src/template_toolkit/src$ cat -n ex3.pl 1 #!/usr/local/bin/perl -w 2 use strict; 3 use Template; 4 5 my $tt = Template->new({ 6 INCLUDE_PATH => '/home/lhp/Lperl/src/template_toolkit/src/tt' 7 }); 8 9 my %perlprogs = map { ( $_ => -s $_) } glob('*.pl'); 10 11 my %vars = ( 12 files => \%perlprogs, 13 ); 14 $tt->process('forexkeyvalue', \%vars); lhp@nereida:~/Lperl/src/template_toolkit/src$ cat -n tt/forexkeyvalue 1 [% FOREACH file IN files -%] 2 [% file.key %] has size [% file.value %] 3 [% END %] lhp@nereida:~/Lperl/src/template_toolkit/src$ ex3.pl ex1.pl has size 266 ex2.pl has size 288 ex3.pl has size 282
Casiano Rodríguez León