#!/usr/local/bin/perl

# COMS3101 Perl Fall 2013
# HW3
# file_list.pl

@files = `ls -l`;
foreach (@files) {
  # Remove wspace
  s/ +/ /g;
  @f = split(/ /,$_);
  # Build AofA
  push @AoA, [ @f ];
}

# Print 3rd field of 2nd row
print "Row2, Field 3: $AoA[1][2]\n\n";

# Print fields 3-5 of row 2 and on:
for $i (1 .. $#AoA) {
  print "Row $i, 3-5: ";
  for $j (2..4) {
    print "$AoA[$i][$j]\t";
  }
  print "\n";
}

