Aggregation: 

my @addresses;
while (<DATA>) {
        push @addresses, NetAddr::IP->new($_);
}
print join(", ", NetAddr::IP::compact(@addresses)), "\n";
__DATA__
202.78.241.16/28
202.78.241.0/28
202.78.241.32/28
202.78.241.0/27, 202.78.241.32/28