Re: fun with hashes!
Brian Duggan <[email protected]> Sun, 25 Nov 2007 15:10:54 -0500
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <4749d6ce.bEeZIpm40X1PLXq1%[email protected]> |
Don't know if this falls into categories already
covered (set of active objects in a class? counting?),
but I often find a hash of open filehandles useful. e.g. to
divide a big file into several smaller ones, using the
distinct values of one of the fields as filenames :
perl -MIO::File -ane '($fds{$F[1]} ||= IO::File->new(">$F[1]"))->print($_)' < bigfile
Brian