I am not sure if I am still in mailing list. so cc'ing myself.

On Mon, Feb 28, 2011 at 2:47 PM, steve park <rich.j...@gmail.com> wrote:

>
> I have a below program and I am not doing it right.
> Currently, only last ip pool is going in since I am putting them w/ key to
> values(so only last one shows up when I print).
>
> How can I aggregate and assign them to server_1 so that when I print below
> will show up?
>
> server_1
> 10.1.1.1
> 10.1.1.2
> 10.1.1.3
> 10.1.1.4
> 10.1.1.5
> 192.168.1.1
> 192.168.1.2
>
>
> while ( <DATA> ) {
>        my @array_ip;
>        chomp;
>        my ($swit,$server,$ip_range) = split;
>
>        my ($b_real_ip,$b_ip, $e_ip) = $ip_range =~
> m#(\d+\.\d+\.\d+\.)(\d+)\-(\d+)#;
>        my $b_ip_copy = $b_ip;
>        my @ip_g;
>        while ( $b_ip_copy <= $e_ip ) {
>            my $b_ip_final = join('',$b_real_ip,$b_ip_copy);
>            push @ip_g , $b_ip_final;
>            ++$b_ip_copy;
>        }
>        $HoA{ join('_',$swit,$server) } = \@ip_g;
> }
>
>
> __DATA__
> server    1    10.1.1.1-10.1.1.5
> server    2    192.168.1.1-192.168.1.5
> server    1    192.168.1.1-192.168.1.2
>
>
>

Reply via email to