CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
problem with equality operator

 



zipflip
Deleted

May 9, 2000, 11:34 AM

Post #1 of 3 (789 views)
problem with equality operator Can't Post

hello i having a hard time and would really appreciate some help with this...

i am trying to change the content of a certain form data $form_data('who_modified')if it is not already defined by making it equal to another predefined variable $session_username. this is what i have:

sub display_toolbox
{
if ($form_data{'who_modified'} eq "")
{
$form_data{'who_modified'} eq $session_username;
}
&search_and_display_db;
}

i don't know why it doesn't work? thanks in advance if you can help me....


kris


Jasmine
Administrator / Moderator

May 9, 2000, 11:52 AM

Post #2 of 3 (789 views)
Re: problem with equality operator [In reply to] Can't Post

When you're assigning a variable, you should use = instead of eq.

$form_data{'who_modified'} = $session_username;

eq is a comparison operator, to be used when you're trying to see if one alphanumeric string is equal to another. You correctly used eq in your as your "if" line.

Corrected Code:
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


if ($form_data{'who_modified'} eq ""){
$form_data{'who_modified'} = $session_username;
}
&search_and_display_db;
</pre><HR></BLOCKQUOTE>


zipflip
Deleted

May 9, 2000, 12:02 PM

Post #3 of 3 (789 views)
Re: problem with equality operator [In reply to] Can't Post

jasmine-

thank you so much i will try that....

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives