in reply to No output to screen or output file

I'm very confused about your coding.

my $filter = "filter"; # I'm a scalar here..
and then later in your code:
$hash{$filter[$c]->[4]} # or am I an array?
besides which you are putting the above in a pair of single quotes
'$hash{$filter[$c]->[4]}' # that will literally be "$hash{$filter[$c +]->[4]}"
not cool.

Start your script off with use strict; and you'll see helpful information.

$ ./booboo.pl Global symbol "$num_elements" requires explicit package name at ./boob +oo.pl line 14. Global symbol "%hash" requires explicit package name at ./booboo.pl li +ne 18. Global symbol "@filter" requires explicit package name at ./booboo.pl +line 18. Global symbol "%hash" requires explicit package name at ./booboo.pl li +ne 25. Global symbol "@filter" requires explicit package name at ./booboo.pl +line 25. Global symbol "@filter" requires explicit package name at ./booboo.pl +line 25. syntax error at ./booboo.pl line 26, near "+]" (Might be a runaway multi-line "" string starting on line 25) Global symbol "$line" requires explicit package name at ./booboo.pl li +ne 28. Global symbol "%hash" requires explicit package name at ./booboo.pl li +ne 34. Global symbol "@filter" requires explicit package name at ./booboo.pl +line 34. Global symbol "@filter" requires explicit package name at ./booboo.pl +line 34. Global symbol "@filter" requires explicit package name at ./booboo.pl +line 34. Global symbol "$line" requires explicit package name at ./booboo.pl li +ne 37. Missing right curly or square bracket at ./booboo.pl line 49, at end o +f line ./booboo.pl has too many errors.

Above is the result of that.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

Replies are listed 'Best First'.
Re^2: No output to screen or output file
by dkhalfe (Acolyte) on Jul 24, 2012 at 18:10 UTC

    I noted that I did not include the entirety of my code. I changed my $filter variable to $filter_data. Also I took off the single quotations from my references to the arrays. This has not solved the problem.

      if($hash{$filter[$c]->[4]} eq $filter_data)

    I believe my problem lays with comparing a reference to an array with a variable (containing a string). Any insight on this would be helpful. Thanks!

    Also, whenI remove the quotes and attempt to run the program the following error appears {Also, 'use strict' is included in my code}

    Error: Use of uninitialized value in string eq at trial1.pl line 142, <IN> line 1767.

          Error: Use of uninitialized value in string eq at trial1.pl line 142, <IN> line 1767.

      here is where I'd put in some print statements to see what values are present in the variables being cited by the error code. You've told me that you didn't include all your code, but there are some things you haven't included that are probably germain to the problem at hand...


      Peter L. Berghold -- Unix Professional
      Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

        Ok, will try that out. Thanks!

      use strict; use warnings; no warnings qw(uninitialized);
      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'