in reply to Difficult flatfile db record

You could probably first just slurp lines one and two into an array:

open FH, $file or die "Can't open $file: $!"; my @lines = (<FH>)[0,1]; close FH;
If the fields are fixed length, you can separate them with unpack. If they are whitespace delimited, split /\s+/ will do to break up the line. Otherwise, you might need a hefty regex. But it looks like they're whitespace delimited, so you could do:

my %data = (); # define all field names my @line1_fields = qw/ batch_suffix_id associated_operations /; my @lines2_fields = qw/ record_created record_created_date ... /; @data{ @line_1_fileds } = split /\s+/, $lines[0]; @data{ @line_2_fields } = split /\s+/, $lines[1];
There, now you have a hash with all your field names.

--
perl: code of the samurai

Replies are listed 'Best First'.
Re: Re: Difficult flatfile db record
by testguy (Initiate) on Sep 16, 2002 at 16:35 UTC
    Thank's Samurai,

    I'll go play around with that. Fields in each line are # delimited so I should be okay..

    -testguy
      Oops... heh. Yeah, just split /#/ instead of /\s+/ :)

      --
      perl: code of the samurai