http://www.perlmonks.org?node_id=861005


in reply to hash problems

Hi Weglarz . Hope the following code will help

#! /usr/bin/perl use strict; use warnings; use Data::Dumper; my %passwords = ("Matt", "s1k1d52", "scuzzy", "2ab928", "Marky", "s829 +1s", "Jeb", "jeb23"); delete $passwords{"jeb"}; if(exists $passwords{Matt}){ print($passwords{Matt}. "is my password.\n"); } if(defined $passwords{scuzzy}){ print($passwords{scuzzy} . " IS defined!\n"); }else{ print("%passwords are everyone's passwords!\n"); }