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' => '' };
In reply to Re^3: Changing the Value Assigned To A Hash Key
by phaylon
in thread Changing the Value Assigned To A Hash Key
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |