If truly must have a digit to start with to do other processing,
then you could do:

#one form could be:

        if ( ! /^\d/ ) {
         # print the headers
       }else {
         # do other processing
       }

# or  another form:

        if ( ! /^\d/ ) {
           print ....
         next;
       }
      # do the other processing and print



Wags ;)
-----Original Message-----
From: Greg [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 22, 2001 14:20
To: [EMAIL PROTECTED]
Subject: pattern matching


Hello again...

I am reading in a file.  There is a header of a varying number of lines.
All the header lines start with non-digits.  I want to write them right back
out, untouched.  All the others get crunched.  I haven't been able to get
past the header.  I will include samples of both below.

  Thanks for your help.



######
#start example code
######
{
open (INDATA, "$sonfile") ||die "cannot open $sonfile $!\n";
open (OUTDATA, "> $result") ||die "cannot open $result $!\n";

        while (($line=<INDATA>))
        {
        chomp($line);
#
#  Need to print the line back out if
#  it doesn't start with a digit.
#
#  Haven't figured out yet...

#


        @_ = ($count, $hour, $minute, $second, $frame,
             $hourb, $minuteb, $secondb, $frameb, $tiff)
             = split(/[: ]/,$line);

#  snip ..
#  do stuff to data...  works fine
#  snip ...


        }

close (OUTDATA);
close (INDATA);
}

############
#end example code
############




############
#start example input file
############

st_format 2
###################################################
#ELSR.SON  --  Captions, Inc. DVD Navigation File 03-08-2001 09:42:20
#Source File:  ELHAZ1SR.SUB
#ELHAZ1SRF "EL HAZARD #1" PIONEER FF/DVD/SDRF/ND WO#67395
#TimecodeType=N
###################################################
SubTitle        ELSR
TV_Type         NTSC
Pixel_Area (0 477)
Display_Area (0 2 719 479)
Color (8 3 2 8)
Contrast (15 15 15 0)
###################################################
SP_NUMBER   START      END    FILE_NAME
0001 01:00:23:00 01:00:26:28 ELSR0001.TIF
0002 01:00:27:00 01:00:31:28 ELSR0002.TIF
0003 01:00:32:00 01:00:36:14 ELSR0003.TIF
0004 01:00:36:16 01:00:38:00 ELSR0004.TIF
0005 01:00:40:04 01:00:42:03 ELSR0005.TIF
0006 01:00:42:05 01:00:44:28 ELSR0006.TIF
0007 01:00:45:00 01:00:48:13 ELSR0007.TIF
0008 01:00:48:15 01:00:51:09 ELSR0008.TIF



##############
# End sample input file
#############


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to