my @ips = ('xxx.xx.xx.xx', 'xxx.xx.xx.xx', 'xxx.xx.xx.xx', 'xxx.xx.xx.xx'); sub callBeforeRequest { @LWP::Protocol::http::EXTRA_SOCK_OPTS = ( LocalAddr => $ips[0] ); push(@ips,shift(@ips)); }