Y
yeti349
Hi, I am trying to modify a file by replacing a tag with the contents
of an array of hashes. I can replace the tag with the first iteration
only; the other array contents are not getting printed. What logic is
missing from the following code? Thanks.
open(FILE, $tmpl) or die "Can't open file: $!\n";
my @html = <FILE>;
foreach my $line (@html)
{
if($line=~/<!--(.*?)-->/)
{
for my $i (0...$#userInfo)
{
$line=qq($userInfo[$i]{uid} $userInfo[$i]{name}
$userInfo[$i]{office}<br>);
}
}
print "$line";
}
of an array of hashes. I can replace the tag with the first iteration
only; the other array contents are not getting printed. What logic is
missing from the following code? Thanks.
open(FILE, $tmpl) or die "Can't open file: $!\n";
my @html = <FILE>;
foreach my $line (@html)
{
if($line=~/<!--(.*?)-->/)
{
for my $i (0...$#userInfo)
{
$line=qq($userInfo[$i]{uid} $userInfo[$i]{name}
$userInfo[$i]{office}<br>);
}
}
print "$line";
}