in reply to Re: Shortening long and dirty code
in thread Shortening long and dirty code

I have very little experience with subroutines in general but I think you're right, that would be the easiest way to go about doing this. Do you mean I should keep my if statements and instead of posting the same code in the iteration instead just call the same subroutine for each of them?

Thanks!

"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

Replies are listed 'Best First'.
Re: Re: Re: Shortening long and dirty code
by hardburn (Abbot) on Sep 04, 2003 at 20:22 UTC

    No need to keep the ifs. Do it in a loop:

    foreach my $i (1 .. 4) { call_sub( param("upload$i") ); }

    The code in the subroutine would basically be what is now in your if statements.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated