If you decided to go the "HOA to CSV" route, then you could create the CSV
like this:

###################################

open(OUTFILE,">temp.csv");
foreach(keys %hash){
  foreach my $elem(@{$hash{$_}}){
    print OUTFILE "\"$elem\",";
  }
  print OUTFILE "\n";
}
close OUTFILE;

####################################

That should create a CSV file with each field in quotes, just in case one of
your array elements has a comma in it.

I think there might also be some convoluted sort() syntax you could use, but
I can't test it here.

-----Original Message-----
From: Connie Chan
To: Timothy Johnson; [EMAIL PROTECTED]
Sent: 7/30/02 11:43 PM
Subject: Re: Sort table with dynamic order of fields

Thanks in advise =)

In case, my source is not an Excel spread sheet, but a Hash Of Array.
So is that mean if I want to use this function, then I have to convert 
my HOA to Spreadsheet, then use the method below to sorting about ? Or 
anything I can do more direct ? Or anything can let me directly convert 
a HOA to CVS ? I would apperciate for any further hints. Thanks !!!

Rgds,
Connie


> 
> Here's a thought:  You can convert the Excel spreadsheet to a .csv
file and
> then use DBD::CSV to sort the fields.  You should be able to do this
using
> Win32::OLE as long as you run it on a system with Excel installed.
The
> macro code fro saving the file to a .csv is:
> 
>     ActiveWorkbook.SaveAs Filename:="C:\My Documents\Book1.csv",
FileFormat:
> =xlCSV, CreateBackup:=False
> 
> I believe the documentation on Win32::OLE can get you started, and I
know
> that there is information out there on how to convert a VB script to a
Perl
> script using Win32::OLE.  You'll need to change the '.'s to '->'s,
etc.
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to