On Fri, 29 Jun 2001, 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

It's a loop label.  It's handy if you have nested loops and you need to go
to the next loop iteration of a loop higher up than the ione you are in.
If you are in the ALL_STUDIES loop, you can say:

next ALL_SESSIONS if $study < 12;

It's not unlike the labels used in various BASIC implementations for
GOTOs.

-- Brett
                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
I got vision, and the rest of the world wears bifocals.
                -- Butch Cassidy

Reply via email to