zentara --

...and then zentara said...
% 
% Hi,

Hello!


% I'm looking for some clever tricks to get a file
% into hash values.
% 
% The file looks like this.
% 
% 10 past 3 (B)=ec020e1ff3a4b82125061fbab300cd21
% 10 past 3 (C)=b840008ed8a11300b106d3e02d00088e
...
% 
% I've been using:
% 
% <code>
...
% open (VS,"< vs") or die "Cant open signature file", $!;  
% @vs = <VS>;
% chomp @vs;
% close VS;

Is there a particular reason you suck the whole file into an array before
turning around and spitting the whole thing into a hash?


% 
% foreach (@vs){
% ($name,$value) = split(/=/,$_);
% $sigs{$name}=$value;}

If this is too slow (particularly if you can get rid of the array suck
step above), you might try manipulating the file itself, which is very
close to a hash declaration of

  %sigs =
  {
    $name => $value
  }

already (hmmm... should those be () istead of {}?).  Anyway, you could
preprocess your sig file into a perl file that you "require" at scan
runtime and thus only pre-handle it when you get a new sig, or maybe
just suck it in and eval that transformation every time.


Just some thoughts from a novice...  HTH & HAND

:-D
-- 
David T-G                      * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: msg26358/pgp00000.pgp
Description: PGP signature

Reply via email to