
Reading into a two-dimensional array from STDIN
Quote:
> perform some grep(ing) and awk(ing) to get multiple occurrences of:
> ctl1 view.cml
> sunysb center.cml
> sunysb center.cml
> sunysb center.cml
> synysb confhome.cml
> synysb confhome.cml
> I understand that first I must read the $dir and $filename into an array,
> which I may then traverse in order to keep a count of occurrences. How
> exactly do I read into that array?
The best place to start is at the beginning. If you knew anything
about perl at all, you'd know that you can do everything you want to
do here, without external grepping or awking, or two-dimensional
arrays.
I would use a hash. The directory is the name of the hash, the file as
the key of the hash, and keep count using the value of the hash.
However, there are as many ways to do any given thing in perl as there
are people using perl.