while(@ARGV) { $_ = shift @ARGV; $ip = shift @ARGV if /-i/ || /--ip/; $port = shift @ARGV if /-p/ || /--port/; }