Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Did something similar years ago --- so...

#!\user\bin\perl -w while (@a_Field=GetCSV(@a_Field)) { print join(' | ',@a_Field)."\n\n"; }; sub GetCSV{ my($s_Line,$s_Text); while ($s_Line=<DATA>) { #print "'$s_Line'\n"; my(@a_Field); $s_Text.=$s_Line; while ($s_Text =~ m{([^",]*)([,\n])|"((?:[^"]|"")*)"([,\n])}gs) +{ unless (substr($`,-1,1) eq '"') { if (defined $1) { push(@a_Field,$1); if ($2 eq "\n") { return @a_Field; }; } else { my($s_Field); ($s_Field=$3)=~s/""/"/g; push(@a_Field,$s_Field); if ($4 eq "\n") { return @a_Field; }; }; }; }; }; return (); }; __DATA__ 10915,"S","Phil","ing Valley Middle School",$0.00,0,,0 10916,"Tr","Ny",,,,,,"999-999-9999",,,,"715000 works at Re-Max Wishing for housecoat with dogs, no luck",$0.00,0,,0 10917,"Ro","Ox","3677 As Dr","W","BC","V4T 2W5",,"1111111111",,,,,$0.0 +0,0,,0 10918,"Sa","Fri",,"K","BC",,,"2222222222",,,,,$0.00,0,,0 10355,"Val","Woj",,,,,,"3333333333",,,,"Solutions",$0.00,0,,0 10356,"Ter","Bes",,,,,,"1211211212",,,,,$0.00,0,,0 10357,"Phi","Har",,,,,,"1231231234",,,,"6 Woodcroft Ave St Catns x1x1x1 999-999-3203 check the address to see if it is still her's.",$0.00,0,,0 10358,"Ra","Gak",,"Kel",,,,"3453453456",,,,,$0.00,0,,0 10359,"J","Ru",,"V","BC",,,"7777777777",,,,"st ing to tell J to come a +gain… (555) 899-9999",$0.00,0,,0 10360,"Li","Sa",,"Win",,,,"4444444444",,,,"LDr Claremont",$0.00,0,,0 10361,"Ke","Ta",,"K","BC",,,"5555555555",,,,,$0.00,0,,0 10362,"Kat","son",,"V","BC",,,"6666666666",,,,,$0.00,0,,0

In reply to Re: Regex Split and Formatting by clueless newbie
in thread Regex Split and Formatting by reaper9187

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-18 02:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found