in reply to perl socket

To get the destination IP address from a command line argument you'd have to use
my $address = shift @ARGV || DEFAULT_ADDR;

Replies are listed 'Best First'.
Re^2: perl socket
by Anonymous Monk on Jan 24, 2005 at 14:44 UTC
    Eh, no. shift || DEFAUTL_ADDR will do just fine, as a trivial example would have shown:
    $ perl -wle 'use constant DEFAULT_ADDR => "127.0.01"; my $address = shift || DEFAULT_ADDR; print $address' 192.168.1.1 192.168.1.1
    It's always wise to test your code before giving advice, but it's quite unwise to *not* test code you're claiming needs to be done differently.