use Socket qw( inet_aton ); if (inet_aton('83.1.1.1') lt inet_aton('82.1.1.1')) { print("is less than\n"); } else { print("isn't less than\n"); }