There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
It depends on what you are trying to do. Do get_states, get_ids, etc., operate on the same set of files in your program?
It may be better if you just have a single sub that returns an array (or reference to an array) of file attributes, or whatever form best suits your application needs, in a manar similar to the stat function. This way, you keep all your code in one spot, plus you have the added benefit of doing only a single pass on the file, instead of each sub doing a separate pass on the same file. You can also pass in an optional parameter, say, -want => [ qw/ id states / ], so that you can tell the sub that you only want a subset of file hashes, otherwise the sub will return the complete set of file hashes. In reply to Re: Versatile subs
by Roger
|
|