Re: data matching

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 10:15:54AM -0400, F.H wrote: > CITY:while (my $line = ){ > > my @line = split /\s*,\s*/, $line; > my $city = $line[3]; > > foreach my $city (keys %state) { > foreach my $street (@{ $state{$city} } ){ > if (

Re: data matching

2001-06-29 Thread F.H
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

Re: data matching

2001-06-29 Thread Michael Fowler
On Thu, Jun 28, 2001 at 08:50:12PM -0400, F.H wrote: I'm not sure if the lack of indentation is in your original code or not, but in case it is, for the sanity of people that need to read your code (like us!) please indent, and indent consistently. Also, always use warnings and strict when debug

Re: data matching

2001-06-28 Thread F.H
Hello Here is my script, I am missing something. All I am trying to do is to skip LA and BURLINGTON lines, because they are missing 'MAIN'. Thanks. I.S my %state; %state = ( CHICAGO => ["MAIN", "BROADWAY", "OAK"], LA => ["DELTA", "GAMMA"], BOSTON => ["FIRST", "MAIN"], BURLINGTON => ["SECOND", "ON

Re: data matching

2001-06-28 Thread Paul
--- Michael Fowler <[EMAIL PROTECTED]> wrote: > On Thu, Jun 28, 2001 at 02:34:31PM -0700, Paul wrote: > > > $city = $record[3] ; > > > for ($i = 0; $i <= $#{ $state{$city}; $i ++ ) { > > > > Never use the > > for( ; ; ) { } > > construct in Perl without a significant and compelling reason.

Re: data matching

2001-06-28 Thread Michael Fowler
On Thu, Jun 28, 2001 at 02:34:31PM -0700, Paul wrote: > > $city = $record[3] ; > > for ($i = 0; $i <= $#{ $state{$city}; $i ++ ) { > > Never use the > for( ; ; ) { } > construct in Perl without a significant and compelling reason. > foreach is virtually always better for lots of reasons. Try

Re: data matching

2001-06-28 Thread F.H
[EMAIL PROTECTED] wrote: > > > --- "F.H" <[EMAIL PROTECTED]> wrote: > > Hi all, > > Hi. =o) > > > I am trying to skip any line in my input file that doesn't have a > > city with a street named 'MAIN'. I am matching record[3] in my input > > file with a $city (array) from a hash (%state) that I

Re: data matching

2001-06-28 Thread Paul
--- "F.H" <[EMAIL PROTECTED]> wrote: > Hi all, Hi. =o) > I am trying to skip any line in my input file that doesn't have a > city with a street named 'MAIN'. I am matching record[3] in my input > file with a $city (array) from a hash (%state) that I got from > another file. The problem is that

data matching

2001-06-28 Thread F.H
Hi all, I am trying to skip any line in my input file that doesn't have a city with a street named 'MAIN'. I am matching record[3] in my input file with a $city (array) from a hash (%state) that I got from another file. The problem is that @city contains more than one element! while ($line

data matching

2001-06-28 Thread F.H
Hi all, I am trying to skip any line in my input file that doesn't have a city with a street named 'MAIN'. I am matching record[3] in my input file with a $city (array) from a hash (%state) that I got from another file. The problem is that @city contains more than one element! while ($line =