in reply to Please help..

I read the OP's previous post and there exists evidence of improvement; therefor, I suggest you guys are being overly harsh. The poster included his output and the desired output; which is more that most posters give us. Not everyone can be an instant Perl God.

Your script sudib_dg77, as posted, contains a simple but insidious error in that early on there is a statement lacking a terminating semicolon. This will cause the rest of the script to not parse properly. Further, it will cause small changes in the script to result in differing behaviours. A situation similar to the troubles you have been encountering. I don't know if this was part of code that you edited out for this post, as it appears to be, or if this is reflected in you production code. If the latter, posting incomplete code is not the same as posting simplified code and is less than helpful.

Your code lacks proper formating in that the indentations seem to be added at random. While the perl compiler doesn't care, those of us reading the code are confused by random indentations. Please only indent statements that are contained inside brackets or are continuation of partial lines. I had to run your code through perltidy in order to read it without straining my poor Pooh-brain. Consequentially, check out perltidy. It's an excellent tool for the new perler.

The documentation for DBI fetchall_arrayref contains this small bit of advice:

"If called in a scalar context for a statement handle that has more than one column, it is undefined whether the driver will return the value of the first column or the last. So don't do that."

Excellent advice! It appears that you are doing exactly that, ie. fetching into a scalar $row. This will cause loss of data as you describe.

Good luck. And I'll apologize for the other's harshness. I hope it doesn't unduly discourage you.

<update> Update: strikeout misquote.</update>


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

Replies are listed 'Best First'.
Re^2: Please help..
by starbolin (Hermit) on Apr 15, 2008 at 17:34 UTC

    OOPs! I misquoted fetchall the quote was from fetchrow. Bad, Bad starbolin. But, now I notice that you do not use the value returned from fetchall. How come? I would expect to see something like print @{$row} where $row is dereferenced back to an array or foreach @{$row} { do-something-with-$_ } to loop over the data in the array referenced by $row.

    Do you understand references? Do these statements make sense? If not, perhaps a read of perlreftut is in order.


    s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}