# hostname 123
hostname 123
vlan create vif1 1 2 3 4 5 6
vlan add vif1 7 8
ifconfig vif1-1 some data here
ifconfig vif1-2 some data here
..
ifconfig vif1-9 some data here
# hostname 456
hostname 456
vlan create vif5 1 2
vlan add vif5 3 4 5
vlan add vif5 6 7 8 9
ifconfig vif5-1 some data here
ifconfig vif5-2 some data here
..
ifconifg vif5-9 some data here
####
$/ = undef;
while ( )
{
@col=split('#',$_);
$/ = \n;
####
foreach (@col) {
print "This is element : $i\n";
if (/vlan/) {
print "found a vlan line\n";
}
if (/ifconfig/) {
print "found an ifconfig line\n";
####
Hostname : hostname123
# of vlans: 8
# of ifconfig lines: 8
Hostname : hostname456
# of vlans: 9
# of ifconfig lines: 9