Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: If condition

by ashish.kvarma (Monk)
on Jul 14, 2009 at 12:22 UTC ( [id://779896]=note: print w/replies, xml ) Need Help??


in reply to Re^3: If condition
in thread If condition

It will make more sense if you move assignment to $sql_content out of loop. You probably want something like
my $cor ; my $date ; for my $data_pair (@data_list) { if($data_pair->{'key'} eq 'correct'){ $cor= $data_pair->{'value'}; } if($data_pair->{'key'} eq 'date'){ $date= $data_pair->{'value'}; } } my $sql_content = "INSERT IGNORE INTO correct SET text='".$cor."' date +='" .$date."'";
If this is what we are looking for than try this as well
my %data_hash = map {$_->{'key'} => $_->{'value'} if ($_->{'key'} eq ' +correct' || $_->{'key'} eq 'date')} @data_list; my $sql_content = "\nINSERT IGNORE INTO correct SET text='".$data_hash +{'correct'}."' date='" .$data_hash{'date'}."'";
Regards,
Ashish

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2024-04-23 10:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found