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] ; }
In reply to Split() first 3 elements of @array by hmb104
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |