<?xml version="1.0" encoding="windows-1252"?>
<node id="990301" title="Split() first 3 elements of @array" created="2012-08-28 14:40:58" updated="2012-08-28 14:40:58">
<type id="115">
perlquestion</type>
<author id="989623">
hmb104</author>
<data>
<field name="doctext">
&lt;p&gt;Dear Monks, &lt;/p&gt;

&lt;p&gt;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:
&lt;/p&gt;
&lt;code&gt;
@Data = split( ' ', $RouterOutput[0,2] );
if ( ( $Data[0] eq 'Device' ) &amp;&amp; ( $Data[1] eq 'ID:' ) ) {
   $SwitchName = $Data[2] ;
   $SwitchName =~ s/$'site.com'//i ;
}
if ( ( $Data[0] eq 'IP' ) &amp;&amp; ( $Data[1] eq 'address' ) ) {
   $SwitchIP = $Data[2] ;
}
&lt;/code&gt;</field>
</data>
</node>
