mitchreward has asked for the wisdom of the Perl Monks concerning the following question:
Hi guys,
Is there a way to export a variable out of the foreach, I've googled it, but don't seems to find something
foreach my $hash_ref2 (@result2) { my $comment = $hash_ref2->{'comment'}; if ($comment =~ /^this is an automatic +comment/) { last; my $done = "1"; } } print $done;
thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: scalar out of a loop
by Corion (Patriarch) on Jul 21, 2014 at 14:16 UTC | |
by mitchreward (Acolyte) on Jul 21, 2014 at 14:24 UTC | |
by Corion (Patriarch) on Jul 21, 2014 at 14:28 UTC | |
|
Re: scalar out of a loop
by LanX (Saint) on Jul 21, 2014 at 14:41 UTC | |
|
Re: scalar out of a loop
by AnomalousMonk (Archbishop) on Jul 21, 2014 at 15:21 UTC | |
by mitchreward (Acolyte) on Jul 21, 2014 at 15:50 UTC | |
|
Re: scalar out of a loop
by Anonymous Monk on Jul 22, 2014 at 01:09 UTC |