in reply to scalar out of a loop
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: scalar out of a loop
by mitchreward (Acolyte) on Jul 21, 2014 at 14:24 UTC | |
by Corion (Patriarch) on Jul 21, 2014 at 14:28 UTC |