Re: Bareword errors?



gcr <reviewyourdemo@xxxxxxxxxxx> writes:

I'll hack around this but curious why first use passes.

The first use passes because it doesn't have the same error.

-----snip -----

#!/usr/bin/perl

use strict;

use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

my $search;
my %HASH;
my $name;
my $value;
my @pairs;
my $buffer;
my $pair;

getweb();

Why are you reinventing that wheel? Have a look at the CGI module - it's
the standard for a reason. (If you're using a book that told you to do
that, take that book back for a refund, and buy one whose author actually
knows what he or she is talking about.)

Also, why are you using global variables for everything, and giving them
nonsensical names like %HASH? Those are bad habits in *any* language.

if (!$HASH{search1}) {
$search = "search2 only";
}

if (!HASH{search2}) {
^
$HASH

$search = "search1 only";
}
if (!HASH{search1} && !HASH{search2}){
^ ^
$HASH $HASH

$search = "no search";
}

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
.



Relevant Pages

  • RE: need help
    ... : Charles K. Clarkson wrote: ... is a file scoped CGI object better than a file ... just as easily pass a hash ref. ... Personally I find it much more important that beginner CGI ...
    (perl.beginners)
  • Re: newbie: need to put form data into associative array
    ... > perldoc CGI ... it returns the parameter list as a tied hash reference. ... > a key changes the value of the parameter in the underlying CGI parameter ... I am the sexiest man in the UuuuKaaaayy ...
    (comp.lang.perl.misc)
  • Re: newbie: need to put form data into associative array
    ... perldoc CGI ... it returns the parameter list as a tied hash reference. ... a key changes the value of the parameter in the underlying CGI parameter ... Called in a list context, it returns the parameter list as an ...
    (comp.lang.perl.misc)
  • %USERACL Is Empty?!
    ... basically %USERACL is a hash containing the key and values read from the ... use strict; ... use CGI; ... Question #1) The following error was generated by "use warnings;" ...
    (comp.lang.perl.misc)
  • Re: cgi.pm distinguish between POST & GET
    ... use CGI; ... #put cgi data into hash ... param returns both GET & POST ...
    (comp.lang.perl.misc)