Stories
Slash Boxes
Comments
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Reinventing Perl Arrays? That's nothing. When I was a wee lad, we had to reinvent the bit every morning before breakfast, and reinvent symbol tables every night before supper. And if we were really lucky, we'd only get beaten five times instead of the usual twenty.

    Seriously though, a former colleague of mine had a better horror story. It went something like this:

    $index = "";
    $element_count = $#array + 1;
    open(TEMP, ">temp.file");
    for( $index = 0; $index < $element_count; $i++) {
        print TEMP $array[$index];
        print TEMP "\n";
    }
    print TEMP $new_value_1;
    print TEMP "\n";
    print TEMP $new_value_2;
    print TEMP "\n";
    close(TEMP);
    @array = ();
    open(TEMP, "temp.file");
    $index = 0;
    while(<TEMP>) {
        $array[$index] = $_;
        $index = $index + 1;
    }
    close(TEMP);
    Now, if you think that's heinous, imaging copying and pasting this chunk of code in each of the few dozen times you need to add an element at the end of an array. In a script that's thousands of lines long.

    ...shudder....