I'm trying to get a script to interpolate variable values in a __DATA__ block if possible. This is a kind of alternative to a full- blown template method. I'm not sure if I can even do what I want, hence my posting here. The following code only goes so far. It correctly prints the value of $$dataref each time GetData is called, but not in the while loop. This is where I'm stuck. 8<--------------------- #! /usr/bin/perl use strict; use warnings;
my @Blocks=qw(first second third); foreach my $block (@Blocks) { GetData($block); } sub GetData { my $data=shift; my $dataref=\$data; print "\$\$dataref is: $$dataref\n"; while (<DATA>) { chomp; if ($_ eq "<$data>") { next; print "$_\n"; } if ($_ eq "</$data>") { last; } print "$_\n"; } } __DATA__ <first> This is the $$dataref chunk. </first> <second> This is the $$dataref chunk. </second> <third> This is the $$dataref chunk. </third> 8<------------------------ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/