I'm trying to validate input from a form field by testing if the value's not null (ie has that form field has been filled in). However, the array is refusing to see anything at all, ie treating a filled-in field as though it hasn't been filled in. But a variable seeing the same field *can* see what's there.
form code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><title></title></head> <body> <FORM ACTION="tst.cgi" METHOD="post" ENCTYPE="multipart/form-data"> <INPUT TYPE="file" NAME="photo00"> <INPUT TYPE="submit" NAME="Submit" VALUE="Submit Form"> </FORM></body></html>
perl code:
#!usr/bin/perl -t use strict; use warnings; use CGI; use CGI::Carp qw/fatalsToBrowser/; use File::Basename; our $query = CGI->new; our @array = (); our $photo = $query->param("photo00"); # check if the field's not null, if not, array it if ($photo != "") {push(@array, $photo);} print "Content-type: text/html\n\n"; print "@array \n"; # this does nothing - how come? print "$photo \n"; # this prints to screen fine
Many thanks, and a very Happy New Year to you all from Spain
In reply to variable sees it, array doesn't - stumped! by shrdlu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |