#!/usr/bin/perl -w use strict; my %hash1 = ( shave => '', the => '', modern => '', way => '', ); my %hash2 = ( shave => 1, the => 1, modern => 1, way => 1, ); my $word = 'modern'; if( exists($hash1{$word}) ) { print "Word $word is in hash1\n"; } if( $hash2{$word} ) { print "Word $word is in hash2\n"; } #### export PERL_DEBUG_MSTATS=1 perl test_hasheffeciency.pl