Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

mako132 (2925)

Journal of mako132 (2925)

Tuesday January 28, 2003
11:31 AM

Perl Through Java Eyes

[ #10235 ]

A Java programmer working in Perl was having a hard time debugging a for loop

for ($i=0,$t_inner=$t_pos;$i<$t_inner;$i++,$t_inner++){
        $sub_date[$t_innner] = $date[$i + $t_sub];

        $sub_list[$t_inner] = $date[$t_sub];

What struck me (besides his lack of use strict and the t_innner != t_inner typo) was how hard it is to read such code from someone who is used to manipulating arrays the hard way.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I'm not surprised the programmer was having a hard time. That's HORRID code.

    Really you (or whoever is the programmer) shouldn't try and do so much in the for (...) bit. If you're going to use the C-style for loop you really should try and limit yourself to the three simple steps: define variable, test variable, increment variable. Anything beyond that is pure obfuscation.