in reply to Re^2: Changing the Value Assigned To A Hash Key
in thread Changing the Value Assigned To A Hash Key
I gotuse warnings; use strict; use Data::Dumper; my @errors; my %app; $app{"first_name"} = param('first_name'); # $app{"first_name"} = "test_value"; if (request_method() eq "POST") { my $first_name_check = &check_name($app{"first_name"}); unless ($first_name_check eq 1) { print "Not through namecheck\n"; $app{"first_name"} = ""; push (@errors, "First Name: ".$first_name_check); } } print Dumper \@errors; print Dumper \%app; sub request_method { return 'POST' } sub param { return 'testname' } sub print_application { # do some stuff with %app and @errors... } sub check_name { my $name = $_[0]; if ($name =~ /^[A-Z][A-Za-z\-']{2,40}/s) { return 1; } else { return "Helpful message."; }
Not through namecheck $VAR1 = [ 'First Name: Helpful message.' ]; $VAR1 = { 'first_name' => '' };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Changing the Value Assigned To A Hash Key
by gnurob (Initiate) on Feb 08, 2005 at 23:28 UTC | |
by phaylon (Curate) on Feb 09, 2005 at 21:51 UTC | |
|
Re^4: Changing the Value Assigned To A Hash Key
by gnurob (Initiate) on Feb 08, 2005 at 23:36 UTC |