How do I use Perl to parse the output of the sqlplus command?

Posted by benjamin button on Stack Overflow See other posts from Stack Overflow or by benjamin button
Published on 2010-05-01T08:03:59Z Indexed on 2010/05/01 13:47 UTC
Read the original article Hit count: 213

Filed under:
|
|

I have an SQL file which will give me an output like below:

10|1
10|2
10|3
11|2
11|4
.
.
.

I am using this in a Perl script like below:

my @tmp_cycledef = `sqlplus -s $connstr \@DLCycleState.sql`;

after this above statement, since @tmp_cycledef has all the output of the SQL query, I want to show the output as:

10 1,2,3
11 2,4

How could I do this using Perl?

© Stack Overflow or respective owner

Related posts about perl

Related posts about unix