Michael Fowler <[EMAIL PROTECTED]> wrote:
>

> You probably shouldn't be using a bare block as a looping construct.  What
> is the intent of your code, what do you want it to do if $street eq 'MAIN'
> or $street ne 'MAIN'?
> 
Sorry I have not been quite clear about what I want to get:

use strict;
my %state = (
       CHICAGO     => [qw(MAIN     BROADWAY    OAK)],
       LA          => [qw(DELTA    GAMMA          )],
       BOSTON      => [qw(FIRST    MAIN           )],
       BURLINGTON  => [qw(SECOND   ONE            )],
       SEATTLE     => [qw(GREAT    MAIN           )],
   );



CITY:while (my $line = <DATA>){
        
my @line = split /\s*,\s*/, $line;
my $city = $line[3];
        
        foreach my $city (keys %state) {
                foreach  my $street (@{ $state{$city} } ){
                        if  ($street ne 'MAIN'){
                             next  ;
                        }
                  
                }
           next CITY;
        }
      
  print "$line\n";

}

__DATA__
STATE ,IL, SDW,CHICAGO
STATE,CA, SFD,LA
STATE, MA, FDR,BOSTON
STATE, CT,FGD,BURLINGTON
STATE, WA, SDF,SEATTLE
__END__

I want my output to be (print only lines where city/ street <> 'MAIN' :
STATE ,IL, SDW,CHICAGO
STATE, MA, FDR,BOSTON
STATE, WA, SDF,SEATTLE

I.S

__________________________________________________________________
Get your own FREE, personal Netscape Webmail account today at 
http://webmail.netscape.com/

Reply via email to