wagleg has asked for the wisdom of the Perl Monks concerning the following question:

Dear Gurus:
I am very new to perl and have inherited a piece of code written in Perl. This utility used utf-8 stuff and convets excel worksheet to xml. When I run this I get following error

Unknown open() mode '>:utf8' at xls-to-xml.pl line 74.

Here is my perl script code snippet

use strict; use vars qw( $MAX_EMPTY_ROWS ); use Win32::OLE qw/CP_UTF8/; ### Settings ### # The number of max empty rows $MAX_EMPTY_ROWS = 5; # Set UTF-8 support on Win32::OLE->Option(CP => CP_UTF8); # Read the xls and the output filenames from the command line die ( usage() ) if $#ARGV != 1; my $xlsfile = shift (@ARGV); my $xmlfile = shift (@ARGV); # Create OLE object - Excel Application Pointer my $xl_app = CreateObject Win32::OLE 'Excel.Application' or die "Cannot create OLE object: ". Win32::OLE->LastError(); # Open Excel File my $workbook = $xl_app->Workbooks->Open($xlsfile) or die "Cannot open workbook '$xlsfile' (".Win32::OLE->LastError()." +)"; do processing..... # Open the output file open(OUTPUT, ">:utf8", $xmlfile) or die "Cannot open file '$xmlfile' for writing";


Can someone help my ?
I am using Perl v5.6.1 (from ActiveState) on Windows 2000
Thanks

janitored by ybiC: <code> and <readmore> tags around code block as per Monastery convention

Replies are listed 'Best First'.
Re: Excel -to-XML conversion utility
by dragonchild (Archbishop) on Sep 12, 2003 at 20:48 UTC
    Upgrade to Perl 5.8.0. ActiveState does support Perl 5.8.0. The problem is that the mode specified in the open() call is available only in Perl 5.8.0 and higher.

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

      Thank You very much worked like a charm !!