Hi, Well, the first problem I sorted by a simple check, to see if the last character was a *, if not, it would check just the end of all the strings. If so, it would scan the entirity of all the strings. The code $mask =~ s/\*//g; was to remove the *'s so the regex wouldn't scan the string for them. I realised that *'s weren't necessary so it removes them.
As for the threads, I'm not sure what you mean by "thread model". I'm using "use threads;", the thread is started up by: threads->new (\&akilltimeout)->detach; I tried putting in "my %akill : shared;" and "my %akill : shared = 1;" but neither of them seemed to help. I hope this is more help than my last post. Dan "Rob Dixon" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Dan wrote: > > Hey, I posted a while ago on a thread marked "More regex reguired!", > > the solution gave there did part of the job I asked. I need something > > more out of that regex though.. > > > > 1) this.is.a.string.to.match.with > > 2) this.is.another.string.to.match.with > > 3) this.is.a.totally.with.different.string > > > > What I want to be able to do, along with what's already been said, is > > to do a search for *.with and it return only strings 1 and 2 (since > > they end in .with). String 3 contains with, but at the moment, this > > code returns that one as well. > > Hi Dan. > > /\/\/\/\/\/\ Misconception Alert /\/\/\/\/\/\ > > Regular expressions don't use the star character the same way glob > does. A star is a shorthand for 'none or more of the previous > character'. > To match a star in your string you need to escape it in the regex > with a backslash like this: > > /\*/ > > which will match a string with a star __anywhere in it__. Regexes work > the other way around from globs in that they will match anywhere > unless you specifically say otherwise, so (more special characters) > > /^\*/ > > matches a star at the start of the string, and > > /\*$/ > > matches a star at the end. > > > I have this: > > > > $mask =~ s/\*//g; > > Totally off-beam here. You're matching lines containing a > literal star character! > > > foreach $key (keys %online) { > > if ($spewcount == 50) { # is there more than 50 results? > > # yes! > > $ended = 1; > > last; > > } elsif ($online{$key}->{host} =~ /$mask/) { > > # no! > > print "User with matching host: $key > > ($key!$online{$key}->{ident}\@$online{$key}->{host}\n"; > > $spewcount++; > > } > > } > > > > What's the alternative solution so a search of *.with returns only > > strings 1 & 2? > > > Because a period is another special character in a regex (matches > any single character) you have to escape that too, so the equivalent > of the glob *.with is > > /\.with$/ > > > Secondly, threads now, I have a thread running beside my program > > which runs a timeout sub every second, and checks to see if a > > variable has a timestamp in the past. If it does, it removes the > > information from the hash. But, at the moment, if I set another key > > on the hash, that information doesn't get passed to the sub, and it > > never checks them. How do I get the new information in the hash over > > to the sub so it can check for timeouts on the new information? > > Apart from asking you what thread model you're using I can't help > here. It sounds very much as if your child process is working on its > own copy of the hash, so the deletes it is doing aren't echoed in > the parent. But I shall stop speculating and wait for wiser words on > the subjext. > > HTH, > > Rob > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]