Maybe you don't want to export a variable out of the loop, but set an existing variable to a different value?
my $comment= '- no comment found -'; foreach my $hash_ref2 (@result2) { $comment = $hash_ref2->{'comment'}; if ($comment =~ /^this is an automatic +comment/) { last; } } print $comment;
In reply to Re: scalar out of a loop
by Corion
in thread scalar out of a loop
by mitchreward
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |