Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^3: Split() first 3 elements of @array

by Kenosis (Priest)
on Aug 28, 2012 at 19:42 UTC ( #990319=note: print w/replies, xml ) Need Help??

in reply to Re^2: Split() first 3 elements of @array
in thread Split() first 3 elements of @array

Try the following:

use Modern::Perl; my @RouterOutput = <DATA>; my $RouterOutput = join ' ', @RouterOutput; my ( $SwitchName, $SwitchIP ) = $RouterOutput =~ /Device\s+ID:\s+([^\s]+).+IP\s+address:\s+([^\s]+)/ +s; say "$SwitchName\n$SwitchIP"; __DATA__ Device ID: Entry address(es): IP address: Platform: cisco WS-C3750G-12S, Capabilities: Router Switch IGMP Interface: GigabitEthernet1/0/28, Port ID (outgoing port): GigabitEth +ernet2/0/7 Holdtime : 145 sec Version : Cisco IOS Software, C3750 Software (C3750-IPSERVICESK9-M), Version 12. +2(55)SE4, RELEASE SOFTWARE (fc1) Technical Support: Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Tue 06-Sep-11 02:59 by prod_rel_team advertisement version: 2 Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, val +ue=00000000FFFFFFFF01022507000000000000A8B1D400F080FF0000 VTP Management Domain: 'networks' Native VLAN: 1 Duplex: full


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://990319]
[markong]: is there any mean to get notified if there are new replies in a thread?
[LanX]: Rat or newest nodes
[LanX]: I think there are RSS feeds you could use, but never used them

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2018-03-19 09:51 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (238 votes). Check out past polls.