I forgot to ask the probably greater question that AM points out below - *why* would one choose to LABEL: a loop?
cheers,
Update: Now that I've a bit of time, I'll try to es'plain my naming preference of singular-for-a-hash-var:
It seems to boil down to what looks more clear in the context of how I most commonly employ the variable types in my code. In the following bogo-code, each $hash{key} is dealt with as an individual (singular) item.
my %param = ( srcdir => '/home/me/perl/', destdir => '/root/perl/', moduledir => 'bar-foo', tarball => 'bar-foo.tgz', ); cd $param{srcdir}; system /usr/bin/tar $param{tarball} ¶m{moduledir} -zcvf and die $! +; system /bin/mv $param{tarball} $param{destdir} and die $!; cd $param{destdir}; system /usr/bin/tar $param{tarball} -zxvf and dir $!
Then in this next kind of hash usage, I still think of each $hash{key} as an individual item. And in the loop, the "keys" conveys the plurality of $hash{key}'s within the greater %hash. At least to me. Heh.
my %info = ( ' script' => "$0", ' executable' => "$^X $]", ' hostOS' => "$^O", ' starttime' => "$^T", ); for (keys %info) { print $_ $info{$key}, "\n"; }
In reply to Re: (2) Thoughts on naming loop LABEL: (Why I name hash vars singular. Why label loops?)
by ybiC
in thread Thoughts on naming loop LABEL:
by ybiC
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |