This is a script for the XChat IRC client (which happens to use Perl as a scripting language, huzzah!) to handle xdcc stuff: sending files to others automatically as they're requested. The script is mostly subroutines that are completely independent of one another. It does What I Expect, and I know the IRC:: bits are right, but I'm wondering if the Perl can be made any more efficient somehow? I'd appreciate any feedback on this. The code is linked to below. This is my longest Perl program so far, and the first I'm showing to the general public, so please be gentle, OK? Thanks for any tips, folks.
First, you don't need to initialize the
$user_index variable to simply store
the value of the first subroutine argument, considering
that the only place you use it is in the line immediately
below its initialization.
Therefore, I'd propose to exchange your if/else block for