Brad Baxter wrote:
Dermot wrote:
I would say say your just being flash but there is something in the
idea of having a sub {s/\s+//g; for @_;@_}. You do get re-usability.

The data is coming from tab-delimited files and I am trying to parse
the data into a sqlite3 db. In the process I'd like to validate the
data but that the subject of another email.


YAWTDI

my $record = {
  contributor  => map { s/\s+//g; $_ } $resolution,
};

That is fine as long as there is only one key/value pair but...

my $record = {
  contributor  => map { s/\s+//g; $_ } $resolution,
  contributor2 => $resolution2,
};

You now have map() operating on the list ( $resolution, 'contributor2', $resolution2 ). Better as:

my $record = {
  contributor  => map( { s/\s+//g; $_ } $resolution ),
};


Or maybe:

my $record = {
  contributor  => grep( [ s/\s+//g ], $resolution ),
};

#  :-)



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to