in reply to .ods file

If your '.ods' file is a spreadsheet export this file to '.csv' file and open that file and use spite function and get data

Try the following code for simple .ods file, your .ods file content will be in the "@arr" use it in the query.

open(FILEHAND,"ex1.csv") || die "File can't be open\n"; my $f_line=<FILEHAND>; $f_line=~ s/\"//g; my @arr=split /\,/ ,$f_line;

Replies are listed 'Best First'.
Re^2: .ods file
by CountZero (Bishop) on Mar 14, 2009 at 11:32 UTC
    This generally considered not the way to deal with CSV-files.

    What will happen if your file containes embedded delimiters? Through $f_line=~ s/\"//g; you have destroyed the quotes (why?) and then you naively split on the comma (which BTW does not have to be escaped in your regex). If you have embedded comma's in your fields you are now totally lost.

    Use any of the CSV modules, such as Text::CSV to do this "The Right Way".

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James