in reply to Re: searching and printing what is wanted
in thread searching and printing what is wanted
I like this one a lot better, but there's a couple of things I'd change. (Constructive criticizim, I hope.)
You're using tempories that you don't need to. For example, you could have just done
(Also, you close SIG instead of ORD in that stanza. I'd use my'd filehandles and {}s to manage their scopes instead, but that's mostly my own superstition and not good style.)open ORD, 'orderedname.txt'; my @name = map {split} <ORD>; close ORD;
There's a little trick I just learned the other day instead of a foreach to convert an array to a hash: my %hash; @hash{@array} = (1)x@array; (Or whatever you want for the values; @array itself might work nicely. (But don't forget the ()s, otherwise you'll get one elem with a string of 1s, and a bunch with undef.)
|
|---|