my $c = 0; printf("\n%-7s %-22s %-18s %-35s %-15s %-16s %-30s\n\n", "ID","MAC","IP","Manufacturer","Authorized","Acknowledged","Notes"); while(@row = $sth->fetchrow_array){ my ($id,$mac,$ip,$man,$auth,$ack,$notes) = @row; push @device_ids, $id; if ($c == 1){ printf( "%-7s %-22s %-18s %-35s %-15s %-16s %-30s\n", colored("$id", 'bold blue on_grey10'), colored("$mac", 'bold blue on_grey10'), colored("$ip", 'bold blue on_grey10'), colored("$man", 'bold blue on_grey10'), colored("$auth", 'bold blue on_grey10'), colored("$ack", 'bold blue on_grey10'), colored("$notes", 'bold blue on_grey10'), ); $c--; } else{ printf("%-7s %-22s %-18s %-35s %-15s %-16s %-30s\n", "$id","$mac","$ip","$man","$auth","$ack","$notes"); $c++; } $cnt++; }