in reply to Re^3: subdirectory question
in thread subdirectory question
Originally I thought of a hash because both posts (reading in a text file and subdirectory question) ask for a hash. If this was indeed some kind of homework, then whoever thought it out knew he can use a hash.
You are right: chomp is actually better, because if you have newlines in filenames, you can give the program a nul-delimited list of filenames, start the script with perl -0, and it would magically work.
I don't think that $names{$_} = (); would be better on memory usage than $names{$_} = 1;, as the former has to allocate an undef, which is not any smaller than an integer. Don't trust me in this however, as I'm not good in perlguts.
|
|---|