in reply to Re: to perl or not to perl
in thread to perl or not to perl

I'll second the part about not using implicit variables. I do this for my own benefit as well, as I am inexperienced enough that I don't always understand what they're going to do.

If you can't get away with any object-oriented stuff, try putting must of your functions in subroutines. That way the main part of your program will just be a series of subroutines:

&get_field_ids(); &get_field_values(); &build_message(); &send_email();

If you name the subroutines well, it should be reasonably obvious what's going on, especially if you add comments.

Chumley

"What are the facts? Again and again and again--what are the facts? Shun wishful thinking, ignore divine revelation, forget what 'the stars foretell,' avoid opinion, care not what the neighbors think, never mind the unguessable 'verdict of history,' -what are the facts, and to how many decimal places? You pilot always into an unknown future; facts are your only clue. Get the facts!"
-- Lazarus Long

Replies are listed 'Best First'.
Re: to perl or not to perl
by Abigail (Deacon) on Jun 09, 2001 at 15:19 UTC
    I strongly disagree not using the implicite variables (mainly $_ and @_, but also @ARGV, ARGV, STDIN and STDOUT). Using them all the time adds needless clutter in your program, making it harder to find out what's going on. Do you really think:
    @foo = grep {$_ =~ /qux/} @bar;
    reads better than
    @foo = grep {/qux/} @bar;
    It doesn't mean you should always use implicite variables, far from that. But never using them is like writing shell scripts without using pipes.

    -- Abigail

      I didn't mean that I *never* use implicit variables. But I still find there are many cases where I find that implicit variables do things I didn't expect.

      Yes, I understand that there are many ways they can make my code more concise and efficient. But I am also thinking of the people who may come after me and have to maintain my code. AFAIK I am the only Perl programmer at my workplace, so I try to keep things as explicit as possible.

      As I learn more about Perl I find myself using it more idiomatically.

      Chumley