#!/usr/bin/perl sub readAS { open(FILE, "< AS"); while() { chomp; ($as,$asname,$asdesc) = split /\s+/,$_,3; $AS{$as} = {"name" => $asname, "desc" => $asdesc}; } close FILE; } readAS(); while(<>) { chomp; next if( $_ !~ /^\d+/); ($as,$inbytes,$outbytes) = split; printf "AS: %5d\tName: %-15s\t\tDescription: %s\n",$as,$AS{$as}->{"name"},$AS{$as}->{"desc"}; printf "Inbytes: %15d\t Outbytes: %15d\n\n",$inbytes,$outbytes; }