This doesn't answer your question but:

sub ReadData ($$) { my ($self, $filename) = @_; my $ar_returnvalue = []; if (!-e "$filename") { Carp::carp("File [$filename] does not exist"); return undef; } open (FLATFILE, '<', $filename) or Carp::croak("Cannot open file [ +$filename]"); while (<FLATFILE>) { chomp; push (@{$ar_returnvalue}, Interfaces::FlatFile::ReadRecord($se +lf, $_)); } close (FLATFILE); return $ar_returnvalue; } ## end sub ReadData ($$)

You are using prototypes but prototypes were introduced to allow programmers to imitate Perl's built-in functions, not for user code per se.    FMTEYEWTK on Prototypes in Perl

You are testing for the existence of a file twice, first with stat and then with open.    In the stat test you are unnecessarily copying the file name to a string before testing it.    What's wrong with always quoting "$vars"?

You should include the $! variable in your error messages so you know why they failed.



$hr_returnvalue->{$CurrentColumnName} =~ s/^\s*(.*?)\s*$/$1/; + # Trim whitespace

That is usually written as:

s/^\s+//, s/\s+$// for $hr_returnvalue->{$CurrentColumnName}; + # Trim whitespace

Which avoids unnecessary substitution.



if ($self->datatype->[$_] =~ /^(?:CHAR|VARCHAR|DATE|TI +ME|DATETIME)$/) { $hr_returnvalue->{$CurrentColumnName} = sprintf (" +%s", $self->standaard->[$_]); } else { $hr_returnvalue->{$CurrentColumnName} = $self->sta +ndaard->[$_]; }

What is the sprintf doing that the simple assignment is not doing?    It looks like you don't need this test at all.


In reply to Re: Reading (the same) data in different ways & memory usage by jwkrahn
in thread Reading (the same) data in different ways & memory usage by Neighbour

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.