in reply to CGI Table Column Selection

This doesn't address your question but the following line

chomp $field,$listname;

does not do a chomp on both scalars. It only chomps the first and then throws away the second. Instead, you want to put the scalars into a list context, like so: chomp ($field,$listname);

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff";
$nysus = $PM . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
Re: Re: CGI Table Column Selection
by devslashneil (Friar) on Jul 09, 2003 at 07:00 UTC
    Wow, i never thought about it, but looking at it now, it seems so obvious, thanks a lot :-)

    Neil Archibald
    - /dev/IT -
      No problem. I also just noticed that you are not using strict or warnings. Always, always, always, use strict and warnings. Just throw 'use strict' and 'use warnings' in at the top of your code.

      One more thing, the most common way to pass arguments into a subroutine is my ($scalar1, $scalar2) = @_;. You used two successive shift calls and if you coninued this practice over the course of a couple of lifetimes, it could lead to a crippling repetitive stress disease. But most importantly, it just makes your code slightly more readable.

      Update: Ignore my admonition about strict and warnings. I see your previous post.

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff";
      $nysus = $PM . $MCF;
      Click here if you love Perl Monks

        Heh, i do always use strict and warnings, this was some test code copied out of my actual program, i didn't put use strict and warnings in this test program because it was only created so i could cut and paste the code into perlmonks :-D

        And usually i do my ($scalar1, $scalar2) = @_; or @ARGV however i wrote this sub with 1 parameter and added a second later. I then cut and paste the sub mostly to make the second one so the bad coding practice followed through.
        I still feel this code is really messy though, just the general way i went about it _feels_ wrong i'm not sure why.

        Neil Archibald
        - /dev/IT -