How can I generate a range of IP addresses in Perl?

ipv4, perl

Solution

Use Net::IP's looping feature:

The `+` operator is overloaded in order to allow looping though a whole range of IP addresses:

Problem

I need to generate a list of IP-addresses (IPv4) in Perl. I have start and end addresses, for example 1.1.1.1 and 1.10.20.30. How can I print all the addresses inbetween?

Original source