Try this:
!/usr/bin/perl
use strict;
my ($vlan);
my (%int);
my (%trunk);
$b = '/bin/bigpipe';
open cmd, "$b trunk list |" || die "error: $b trunk list";
while ( ) {
$vlan=$1 if (/^trunk\s+([^\s]+)\s+\{/i);
$trunk{$vlan}=$1 if (/^\s+interface\s+(.+)/i);
} close cmd;
open cmd, "$b vlan list |" || die "error: $b vlan list";
while ( ) {
$vlan = $1 if (/^vlan\s+([^\s]+)\s+\{/i);
$int{$vlan}=$1 if (/^\s+interfaces\s+(.+)/i);
$int{$vlan}= "$1: $trunk{$1}" if (/^\s+trunks\s+(.+)/i);
} close cmd;
open cmd, "$b self list |" || die "error: $b self list";
while ( ) {
print "$1 = " if (/^self\s+([^\s]+)\s+\{/i);
print "$1 ($int{$1})\n" if (/^\s+vlan\s+([^\s]+)/i);
} close cmd;
Sample:
[root@ltm:Active] ~ perl hum
10.10.10.10 = ext (1.3)
11.0.0.40 = int (1.6)
20.1.1.1 = tagged_vlan (tagged 1.2)
1.1.1.2 = trunk_vlan (tr_test: 1.10 1.11)
1:1:1:1:ffff:ffff:ffff:eeee = vlan6 (1.1)
Is that what you need?