#!/usr/bin/perl -w use Net::Telnet::Cisco; use strict; my $linec; my $line; my $interface; my $pvc; my $array; my $ip; my $cbr; my $session = Net::Telnet::Cisco-> new (Host => '10.200.2.100'); $session->login('admin', 'cisco'); # Execute a command my @output = $session->cmd('show run'); #print @output; foreach(@output) { if ( $_ =~ "interface ATM" ) { $interface=$_; chomp($interface); #print "$_\t"; print" Int:\n $interface \n\n"; } if ( $_ =~ "pvc"){ $pvc=$_; chomp($pvc); #print "$_\t"; print" PVC\t :$_\t\t "; } if ( $_ =~ "protocol ip " ){ $ip=$_; chomp($ip); #print "$_\t"; print" IP\t :$ip\n"; } if ( $_ =~ "cbr" ){ $cbr=$_; chomp($cbr); #print "$_\t"; #print" CBR|$cbr"; } #print "Int:$interface | PVC:$pvc | IP:$ip |Cbr:$cbr \n"; # print " Int|PVC |IP|Cbr \n"; #print" $interface |$pvc|$ip|$cbr \t"; }