Hi all,

I've got a script that read in a HTML template file to an array, and then 
write it out a number of times substituting part of the text.

Can anyone tell me why the following code fragment works

__BEGIN__
my $line='';
print $line while ($line=shift @HTML)!~/^<!--break/; # copy until break
do {} until (shift @HTML)=~/^-->/; # skip to end of comment
print "blah\n"; # insert replacement code

print "$_" foreach (@HTML); # copy rest of file
__END__

while this one, using $_ instead of $line fails stating once per line before 
the break that I'm using an uninitialised variable on the 'while' line

__BEGIN__
print while (shift @HTML)!~/^<!--break/; # copy until break
do {} until (shift @HTML)=~/^-->/; # skip to end of comment
print "blah\n"; # insert replacement code

print "$_" foreach (@HTML); # copy rest of file
__END__
-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to