hmb104 has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I'm getting about 10 lines when I perform a query on a Cisco router. From these 10 lines I need the some info from the first 3 lines. Hwo I can use the split function on ONLY the first 3 lines of the array? Below is my Code:
@Data = split( ' ', $RouterOutput[0,2] ); if ( ( $Data[0] eq 'Device' ) && ( $Data[1] eq 'ID:' ) ) { $SwitchName = $Data[2] ; $SwitchName =~ s/$'site.com'//i ; } if ( ( $Data[0] eq 'IP' ) && ( $Data[1] eq 'address' ) ) { $SwitchIP = $Data[2] ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Split() first 3 elements of @array
by philiprbrenan (Monk) on Aug 28, 2012 at 18:46 UTC | |
by hmb104 (Sexton) on Aug 28, 2012 at 19:10 UTC | |
by ig (Vicar) on Aug 28, 2012 at 20:40 UTC | |
by Kenosis (Priest) on Aug 28, 2012 at 20:48 UTC | |
by Kenosis (Priest) on Aug 28, 2012 at 19:42 UTC | |
|
Re: Split() first 3 elements of @array
by philiprbrenan (Monk) on Aug 28, 2012 at 18:43 UTC | |
|
Re: Split() first 3 elements of @array
by pvaldes (Chaplain) on Aug 29, 2012 at 16:40 UTC |