in reply to help! Please please help!

What is the following line supposed to do?

$server =~ s//Nothing/gi

As it is, it adds "Nothing" between each character in $string. Is that what you want?

As an aside, please use <code>...</code> around your code so it renders and downloads nicely. Then you don't need to add HTML-formatting to your code.

Replies are listed 'Best First'.
Re^2: help! Please please help!
by weezer316 (Initiate) on Mar 14, 2008 at 12:46 UTC
    Corion, thanks! I'll rememeber that for next time! Right, basically that line is supposed to replace the value in server, which is blank, with nothing. I realise it wont do that now, but if I take it out it just says this now.

    "Cant coerce arrays into has at line 39"

    Most of the time the array will be blank, does that matter? Its still that line

      Maybe you can tell us what line 39 is?

      If you want people to easily check your code, please edit your above node and put your code in between <code>...</code> tags. That way, it will render and download nicely for everybody.

      It also often helps to supply example data with the program, or to reduce the program so it doesn't need any external data anymore yet still reproduces the problem.

      As for your concrete problem, you seem to be confused about the data structure you have. The line

      foreach my $type ( @{$rbl_list{$omr}{blackholes} })

      tries to access the values in %rbl_list as a hash, but before that, you filled it with references to arrays. I find that using Data::Dumper often helps to visualize the data structure and to find where my assumptions about the data structure do differ from reality.

        Corion,
        That line you mentioned is line 39!

        Right, ill have a go with data::dumper and see where it gets me.

        Im still confused though, i thought I was refereing to a line in hash, which had the IP's as the keys and the results stored in an array, as there might me more than one and I needed to refer to them serperatly. Or do I have the worng end of the stick there?

        Cheers

      The issue is that you are trying to access an array element like a hash element. You put array refs into a hash here:

      $rbl_list{$ip} = \@listed_by;

      And later access like this:

      @{$rbl_list{$omr}{blackholes}

      $rbl_list{$omr} is an array ref, so $rbl_list{$omr}{blackholes} is like saying $arrayref->{$somekey}. (You also probably want $blackholes not the bareword blackholes)

      Edit: I am undone by corion's speed.