[linux] Perl: to hash or not to hash

Hugo van der Kooij hvdkooij op vanderkooij.org
Zo mei 7 23:07:49 CEST 2006


Hoi,

Ik heb iets mafs met perl wat waarschijnlijk aan mij ligt. Maar ondanks
het nodig leesvoer kom ik er nog niet uit.

Ik begin met een hash om namen naar een numeriek ID te vertalen:

	my %avid = {
	   "Aladdin Knowledge Systems" => 999,
	   "Authentium" => 999,
	   "Avira" => 9,
.....
	   "Trend Micro" => 3,
	};

En daarna wil ik het juiste ID ophalen met iets als:

	my $antivirus_id = $avid{"$antivir"};

En druk het af met:

	print "\t\t$item\t$antivir($antivirus_id)\t$virusname";

Maar daar is $antivirus_id altijd een lege string.

Ik zie dan bijvoorbeeld:

	1       Authentium()    W32\/Downloader\.SEL\@dl

En waar ik nu de bok schiet ontgaat me dus even totaal. Maar wellicht dat
iemand anders het wel zo ziet.

Hugo.

-- 
	I hate duplicates. Just reply to the relevant mailinglist.
	hvdkooij op vanderkooij.org		http://hvdkooij.xs4all.nl/
		Don't meddle in the affairs of magicians,
		for they are subtle and quick to anger.



More information about the Linux mailing list