if (@grep) { my $hop; my $static; my $tag; my $vpna; my $dns; print GREEN "\nFound some static routes...\n", RESET; foreach my $line (@grep) { if $line ( =~ m/^(\S+):\s+static-route (\S+) next-hop (\S+)( preference \d+|)( bfd-enable|) tag (\d+)/ ){ my ( $dns, $static, $hop, $tag ) = ( $1, $2, $3, $6 ); } if $line ( =~ m/^(\S+)-\s+service-name (\S+)/ ){ my ($vpna) = ( $2 ); } $results{$dns}{$vpna}{$static}{$hop} = $tag; } print Dumper \%results; for my $box ( keys %results ) { print BOLD "\n$box\n", RESET; for my $static ( keys %{ $results{$box} } ) { for my $hop ( keys %{ $results{$box}{$static} } ) { print "$static\t next-hop $hop\t"; print "tag $results{$box}{$static}{$hop}\n"; print "\n"; } } } } else { print "No static routes exist for $ip\n"; } }