Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: output to excel

by thenaz (Beadle)
on Aug 04, 2011 at 12:26 UTC ( [id://918513]=note: print w/replies, xml ) Need Help??


in reply to output to excel

The easiest thing (in my opinion) is to use a comma-separated-values format, and import into Excel.

open INPUT, "<./input.txt"; # assuming that's your input open OUTPUT, ">./output.csv"; # comma-separated-values output print OUTPUT "First column heading,Second column heading,Third column +heading\n"; while (<INPUT>) { my $first = s/(\d+)\.+//; my @others = split /\s\+/; print OUTPUT join(',' ($first, @others)).$/; }

Replies are listed 'Best First'.
Re^2: output to excel
by cjb (Friar) on Aug 04, 2011 at 12:34 UTC
    If you're going to take this approach, you'll probably be better of looking at Text::CSV unless you can be 100% sure that your input will never contain any commas.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://918513]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-24 19:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found