Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: foreach problem?

by Tyke (Pilgrim)
on Mar 05, 2001 at 18:06 UTC ( #62232=note: print w/ replies, xml ) Need Help??


in reply to foreach problem?

my @words = split(/\s+/, $_[0]); # <-- Better to split on any whi +tespace my $newquery = qq[SELECT "taskID" from "repair" WHERE ("repairKEYWOR +D1" = '')]; foreach my $currentword (@words) { # <-- Current word goes outsid +e brackets $currentword =~ /^([\w]+)$/; $newquery .= qq[ or ("repairKEYWORD1" = '$currentword')]; $newquery .= qq[ or ("repairKEYWORD2" = '$currentword')]; $newquery .= qq[ or ("repairKEYWORD3" = '$currentword')]; }
Note use of qq rather than quoted strings

Does it work any better?

Update Splits better on /s than /S... but you saw that


Comment on Re: foreach problem?
Select or Download Code
Re: Re: foreach problem?
by fastkeys (Novice) on Mar 05, 2001 at 18:16 UTC
    Thanks - just tried that but I still get the same output.

    I've checked that the data I'm sending gets to $_[0] but the output is the same.

    Anybody else?

    Thanks again

    Alex

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (14)
As of 2014-09-16 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (40 votes), past polls