----- Original Message ----- 
From: Jack Lauman <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 21, 2001 11:48 PM
Subject: Another Regex Question


> I'm trying to create a CSV file from the text data below.  Lines
> containing High and Low Tide data have 9 fields, lines having
> sunrise/sunset and lunar data have 8 fields.
> 
> How you differentiate between the two conditions?
> 
> 2000-12-03 11:30 AM PST   9.39 feet  High Tide
> 2000-12-03  4:15 PM PST   Sunset
> 2000-12-03  7:56 PM PST   First Quarter
> 2000-12-04  3:42 AM PST   2.81 feet  Low Tide
> 2000-12-04  7:48 AM PST   Sunrise
> 
> <--------->
I dont think you need a reg exp for that.
try this
 
 while (<INFILE>) {
 
  my @fields = split;
  if (@fields == 9) {
     # do your tide stuff
  }elsif (@fields == 8) {
    # do your lunar stuff
  }else {
  #what is wrong?
 } 
}

maarten

Reply via email to