You can also use if for inner and outer loops. For example
OUTER: foreach(@array1) {
INNER: foreach(@array2) {
next OUTER if /find this/;
}
}
So for every value in @array1, you are testing each value in @array2. When
you find that value in @array2, you stop and move onto the next value in
@array1.
John
-----Original Message-----
From: Aaron Craig [mailto:[EMAIL PROTECTED]]
Sent: 29 June 2001 15:18
To: [EMAIL PROTECTED]
Subject: Re: is this a structure of some kind?
ALL_CAPS:
is a label that sets off a block of code. A more obvious use for it would
be to emulate the switch structure in C++:
SWITCH:
{
if($var == 1)
{
do something
last SWITCH; # skip the rest of this block
}
if($var == 2)
{
do something else
last SWITCH; # skip the rest of this block
}
do some default thing
}
basically, a string followed by a colon is a point in the code that you can
tell the program to go to using keywords like next, last, etc.
somewhere in your script, there must be a reference to ALL_SESSIONS and
ALL_STUDIES -- hopefully not using the dreaded goto! :)
At 09:10 29.06.2001 -0500, Humberto Varela wrote:
>sorry to ask such a simple question, but i can't find reference to this
>syntax in a couple of my Perl reference books (i think it's time i bought
>the Camel book)
>
>----------
>
>
>ALL_SESSIONS: foreach $session_dir (@ARGV) {
> @studies = `ls -1 "$session_dir" `;
> @session_path = split /\//, $session_dir ;
> $session = $session_path[$#session_path] ;
> print "\n Checking $session:" ;
>
> ALL_STUDIES: foreach $study (@studies) {
> chomp $study;
> $numfound = 0;
> @hits = (); # new list
>
>----------
>
>the items in CAPS: are some kind of structure, right?
>
>i just haven't seen the CAPS: notation yet.
>
>thanks.
Aaron Craig
Programming
iSoftitler.com
--------------------------Confidentiality--------------------------.
This E-mail is confidential. It should not be read, copied, disclosed or
used by any person other than the intended recipient. Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful. If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.