use Text::Template; use Tie::Cycle; use strict; use warnings; my $counter = 0; my @tag; foreach my $tag (qw(tag1 tag2)){ my $file = $tag.'.txt'; open my $fh, q{<}, $file or die qq{cant open *$file* to read: $!}; chomp(my @values = <$fh>); $counter++; tie $tag[$counter], 'Tie::Cycle', [ @values ]; } my $template = Text::Template->new(SOURCE => 'text.txt'); foreach (1..4){ my %vars = ( tag1 => $tag[1], tag2 => $tag[2]); my $result = $template->fill_in(HASH => \%vars); print "$result\n"; }
In reply to Re: Text Tagging
by Anonymous Monk
in thread Text Tagging
by anlamarama
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |