>>>>> "s" == sono-io <sono...@fannullone.us> writes:
s> Maybe it's too early in the morning here, but I can't seem to remember how to use a lexical $variable that is defined inside a foreach loop, outside of that loop. =:\ s> Here's the loop: s> foreach my $name (split (/, */, $names)) { s> next unless ($name =~ /\w/); s> my $sortstr = substr("00$totalcells", -2); that looks like you are forcing leading 0's. the common idiom for that is sprintf "%02d", $totalcells. your way works but is harder to read. s> $html =~ s|</td><td|</td>\n<td|g; why are you doing that insert of a newline each time in that loop? you don't use or modify $html anywhere else in this loop. s> $cell{"$sortstr$name"} = "<!--//CELL $name//-->"; s> $cell{"$sortstr$name"} =~ s/\[NAME\]/$name/sig; you just assigned that value the line before. unless $name has [NAME] inside it, how could that s/// op ever do anything? s> $totalcells++; s> } s> I want to use "$name" in another loop just after this one, but when I do, I get "Global symbol $name requires explicit package". did you want to use $name as the loop variable again? that is perfectly fine as this $name is scoped only to that loop. if you just want to use $name for any other reason you need to just declare it with my. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/