o.k. my program finally works (thanks for the help yesterday) . . . but I am
convinced I am doing this the long way . . . I am sure there is a more
elegant solution (prob a one-liner). Any thoughts . . .

thanks,

tim

#!/usr/bin/perl -w
# This program is just to test my ability to parse

open(MYFILE,'test2.txt');
$lNum = 1;

while (<MYFILE>){
    $line = $_;
    chomp($line);
    next if $line =~ (/^\*+/)|(/^\s*$/);  # no blank lines or lines that
start with ***
    @splitLine = split(/:\s/,$line);    # divide
    $splitLine[0] =~ s/^\s*//;          # remove leading spaces from each
one
    $splitLine[1] =~ s/^\s*//;
    $splitLine[0] =~ s/^\s+$//;         # remove trailing spaces from each
one
    $splitLine[1] =~ s/^\s+$//;
    print "$lNum\: \"$splitLine[0]\",\"$splitLine[1]\"\n";
    $lNum++;
};

____________________________________________________
Timothy B Booher, Lt USAF, AFRL/MNAC
101 West Eglin Blvd, Suite 339 
Eglin AFB FL 32542-6810 
Phone: 850-882-8302 Ext. 3360 (DSN 872-)
FAX: 850-882-2201

Reply via email to