Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Write array contents to csv file

by OfficeLinebacker (Chaplain)
on Jul 11, 2013 at 12:30 UTC ( [id://1043708]=note: print w/replies, xml ) Need Help??


in reply to Write array contents to csv file

I'm trying to figure out what the $empid and @array do. Why don't you split out the statements so you can diagnose what's going on better? Or use an Array of Arrays? Also, do you have to put another set of parens around the list you created with @empid and @array, e.g.
my $line = join /\t/ , ($empid, @array); push @report, $line;

Replies are listed 'Best First'.
Re^2: Write array contents to csv file
by learner@perl (Novice) on Jul 11, 2013 at 14:11 UTC
    Hi,

    $empid contains numeric value like 12 and @array contains values like Name DOB DOJ Country Place Salary, i am pushing all the values from $empid and @array to @report using join and all values are tab delimited

    i used the code below and executed

    my $line = join /\t/ , ($empid, @array); push @report, $line;

    Output i got as below

    Name DOB DOJ Country Region Salary Place JKSLK1989010120000101FranceALMERIA100000.00BCFGHK

    Output expected

    Name DOB DOJ Country Region Salary Place JKSLK 1989010120000101 France ALMERIA 100000.00BCFGHK

    i am trying to write this output to csv file, how can i do that, any solution please

      Are you viewing the csv file in Excel ? If so, rename it to report.xls and then see what you get.

      poj
        Hi,

        I can see the expected data, but after renaming the file from .csv to .xsl, i hope the data is saved in Text(Tab delimited, when i click on the .xsl file, its throwing an warning message like format is not supporting, the message is the file is in a different format than specified

        Thanks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-19 10:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found