Parse Airodump-NG Output with Perl

I had to enumerate all the wireless access points around school today. So I booted up BackTrack 4 on my Eee PC and ran airodump-ng to create a list of ESSIDs, their corresponding BSSIDs, and the channels they were running on. Start off by running airodump-ng to save the data:
airodump-ng ath0 -w enum
That saves all the data to enum-01.txt, .csv, and .cap files. The .txt file itself is difficult to read, so I wanted to make a perl script to parse the data to a much more readable format. This is what I came up with:
#!/usr/bin/perl -w 

my @data;
my @bssid;
my @fts;
my @lts;
my @channel;
my @speed;
my @privacy;
my @cipher;
my @authentication;
my @power;
my @num_beacons;
my @num_ivs;
my @lan_ip;
my @idlen;
my @essid;

# read the airodump file
open FILE, "" or die $!;

while ("); ?>) {
	# lines are put in default $_ var, split reads this by default	
	@data = split(/,\s*/);

	push(@bssid, $data[0]);
	push(@fts, $data[1]);
	push(@lts, $data[2]);
	push(@channel, $data[3]);
	push(@speed, $data[4]);
	push(@privacy, $data[5]);
	push(@cipher, $data[6]);
	push(@authentication, $data[7]);
	push(@power, $data[8]);
	push(@num_beacons, $data[9]);
	push(@num_ivs, $data[10]);
	push(@lan_ip, $data[11]);
	push(@idlen, $data[12]);
	push(@essid, $data[13]);



# get unique essids

my $essid_search;	# easier to remember/type than $essid[$i];
my @unique_essids;	# array of unique essids
my $unique_essid;	# var used in foreach loop as the current unique essid
my $check_unique;	# bool, if true (1) essid is unique

foreach ($i = 0; $i <= scalar(@essid); $i++) {
	$essid_search = $essid[$i];

	# if blank essid go to next
	if (!$essid_search) {	

	# loop through and see if it's a unique essid
	$check_unique = 1;
	foreach $unique_essid (@unique_essids) {
		if ($essid_search eq $unique_essid) {
			$check_unique = 0;			
	# if unique, add it to @unique_essids
	if ($check_unique == 1) {
		push(@unique_essids, $essid_search);

# look at all the essid, then print out corresponding bssid and channel
my $essid_match;
foreach $essid_match (@unique_essids) {

	print "Matching for $essid_match\n";
	print "-----------------------------------------------------\n";
	print "\tBSSID\t\t\tCHANNEL\tPRIVACY\n";
	print "-----------------------------------------------------\n";

	for ($i = 0; $i <= scalar(@essid); $i++) {
		if (($essid[$i]) && ($essid[$i] eq $essid_match)) {
			print "\t".$bssid[$i]."\t".$channel[$i]."\t".$privacy[$i]."\n";
	print "=====================================================\n\n\n";
Nothing fancy going on here and you'll have to change the open FILE section to correlate to the name of your capture file. This also ignores blank ESSIDs, as for my project I did not need them. Either way quick and easy and much better looking. I'll probably expand on this for future use but this is where I'll leave it for now.