There are a couple of minor issues with this implementation related to the last bit of code (to print out the results).

First off, it is extremely unwise to set any punctuation vars (which $LIST_SEPERATOR happens to be, even if it doesnt look it) without utilizing a local and an enclosing scope. Even though it isnt directly an issue in the code you posted its best not to get into bad habits. (This criticism applies to Abigail-II as well. You and he probably know when this is ok and when not, but it is unlikely the OP does. :-)

Second is the use of use English; which unless this has been fixed (I dont know if it has or not in newer perls, and certainly hasnt in older ones) then the module carries an unnacceptable performance penalty for programs that use regexes. (It triggers "saw-ampersand" which causes regexes to be signifigantly slower in ALL code used in the current running interpreter.) The general rule of thumb is to not use English but just learn the mnemomics of the punctuation vars. $" and $, are not difficult to remember IMO, even if they do look weird.

Anyway, all that aside IMO Its better to just say

# And show the resulting array. foreach my $row (@data) { print qq(["),join('", "',@$row),qq("]\n); }

as it actually works out that even when you use $" or $, directly that the join statement is less chars to type:

{local$"=','; print "@array\n";} print join(',',@array),"\n";

And doesnt have any potential for accidental action at a distance which is what you get by setting any of the punction vars without localizing them as tightly as possible.

Anyway, it was cool of you to produce a "beginners" version of Abigail-IIs code. ++ to you.


---
demerphq

<Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

In reply to Re: Re: find and replace project with values coming from a table by demerphq
in thread find and replace project with values coming from a table by optiontrader

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.