Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Here is my code that uses Text::CSV::Simple; the goal was to parse a NYSE price list from the Wall Street Journal.
use strict; use Text::CSV::Simple; #usage wsj2csv AMEX091806.txt my ($filename) = shift; print $filename."\n"; print "What is the trading date(MMDDYY)?"; my $traddt = <STDIN>; print $traddt."\n"; my $parser = Text::CSV::Simple->new; $parser->want_fields(1, 2, 3, 4, 5, 6, 8); my @data = $parser->read_file($filename); my $datalines = @data; print $datalines."is number of rows.\n"; for my $row(@data) { my @line = @$row; foreach my $row1(@line) { print $row1.","; } print "\n"; }

I intend to add more functionality to this; but this thread was helpful to me in getting the parser to work

In reply to Re^2: Best method of munging CSV data - using Text::CSV::Simple? by Scott7477
in thread Best method of munging CSV data - using Text::CSV::Simple? by billie_t

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 or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2021-09-19 01:15 GMT
Find Nodes?
    Voting Booth?

    No recent polls found