....same code needs to run on win and unix.

Well this will not run on Windows open SQLP, "|sqlplus -s /nolog >> $output_file_name "

If you want it portable you will just have to write some more code probably using DBI. You will be hard pressed to get system calls that will port although you can branch. For example in some of my application installation scripts I will often do this sort of thing to get the required behaviour, quotes, grammar, etc, etc:

my $OS = $^O; my $cwd = cwd(); my $script = $0; $OS =~m/MSWin32/ ? system('cls') : system('clear'); [blah] sub cpan_install { my ( @modules ) = @_; # get the right quotes for the OS Win wants " *nix wants ' my $quote = $OS =~m/MSWin32/ ? '"' : "'"; print " I will now try to install the missing modules using the CPAN shell. If you have not used this before you will need to answer a number of initialization questions. You can generally just accept the defaults and it will work. Unfortunately if you have not used it before and try + to use it here it will hang invisibly waiting for your input, so you w +ill need to run it from the command line using the command below....\n\n"; for my $module ( @modules ) { my $cmd = 'perl -MCPAN -e ' . $quote . 'install '. $module . $ +quote; print "Trying to install $module command line $cmd\nPlease be +patient.....\n"; print `$cmd`; } }

It works on *nix and Win but the code per se is not portable - there is just different code for each system....

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: read return value from a sql script using piped open by tachyon
in thread read return value from a sql script using piped open by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.