Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: ForEach Command struggle..

by tfrayner (Curate)
on Nov 01, 2001 at 05:37 UTC ( #122477=note: print w/replies, xml ) Need Help??

in reply to ForEach Command struggle..

Okay, here goes...

First off, you would really benefit from use strict. I know that gets said a lot around here, but it's also true. You appear to be using symbolic references (i.e. terms such as ${$locationold}{online}++ in this context), also Not a Good Thing, since apart from anything else they're easily mistaken for hard refs, and it's not obvious what they're pointing to unless you're very careful.

I've not dug into the code perhaps as far as I should, but a couple of things stand out. The $place and $title variables are used only once, suggesting a typo (use strict helps here. Really. It saves me on a daily basis). Also, I'm not sure about what you're splitting on. You say it should be '|+|', but your first split is using 'x' as the delimiter.

There may be fundamental misconceptions in the rest of the code, or it may well be fine. I suppose I might be inclined to use separate %exists hashes for each set of terms you're using it for, in case of overlap (unlikely, but not impossible). I may also have seriously misunderstood something :-)

Anyway, hopefully this will give you a start. Good hunting,


Update: I just realised, the line $line="$ipx$timex$placex$title"; probably won't work either, because you don't have variables named $ipx, $timex, $placex etc. Writing it

would be better. Especially if you had variables named $place and $title ;-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://122477]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2020-10-22 20:06 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (230 votes). Check out past polls.