GIDForums  

Go Back   GIDForums > Computer Programming Forums > Miscellaneous Programming Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 24-Jul-2007, 22:40
Reny's Avatar
Reny Reny is offline
Junior Member
 
Join Date: Aug 2006
Posts: 60
Reny is on a distinguished road

PERL If/ else Statement problem


I am confused if i should post this thread at PHP section or here.
But nvm, 1st i'm new to PERL and i'm using ActivePerl-5.8.8.817-MSWin32.

I found no a big deal for me to start since it's almost similar with C++ until i came to if else statement.

CPP / C++ / C Code:
$input = "B"

if ($input eq "B")
{ print ("good job"); }
else
{ print ("Oh no");  }

Well...incorect during complilation, i tried to erase the "(" and ")" at the print statement, still working the same :-/
  #2  
Old 24-Jul-2007, 23:07
Reny's Avatar
Reny Reny is offline
Junior Member
 
Join Date: Aug 2006
Posts: 60
Reny is on a distinguished road

Re: PERL If/ else Statement problem


Quote:
Originally Posted by Reny
I am confused if i should post this thread at PHP section or here.
But nvm, 1st i'm new to PERL and i'm using ActivePerl-5.8.8.817-MSWin32.

I found no a big deal for me to start since it's almost similar with C++ until i came to if else statement.

CPP / C++ / C Code:
$input = "B"

if ($input eq "B")
{ print ("good job"); }
else
{ print ("Oh no");  }

Well...incorect during complilation, i tried to erase the "(" and ")" at the print statement, still working the same :-/
nvm i had solved it myself, it's an silly mistake. Here i got the latest problem:

CPP / C++ / C Code:
$input = <STDIN>;

if ($input eq "A")
{ print ("good job"); }
elsif ($input eq "B")
{ print ("Oh no");  }
elsif ($input eq "C")
{ print ("C");}

And when i input "A" "B" or "C" nothing happen, i wonder y..
  #3  
Old 24-Jul-2007, 23:20
Reny's Avatar
Reny Reny is offline
Junior Member
 
Join Date: Aug 2006
Posts: 60
Reny is on a distinguished road

Re: PERL If/ else Statement problem


Quote:
Originally Posted by Reny
nvm i had solved it myself, it's an silly mistake. Here i got the latest problem:

CPP / C++ / C Code:
$input = <STDIN>;

if ($input eq "A")
{ print ("good job"); }
elsif ($input eq "B")
{ print ("Oh no");  }
elsif ($input eq "C")
{ print ("C");}

And when i input "A" "B" or "C" nothing happen, i wonder y..

Another nvm, sorry i solve it myself again.
The statement input should be
CPP / C++ / C Code:
if ($input eq "A\n")
im not sure and i tried it, that's the last input in all string, thx a lot.
 
 

Recent GIDBlogInstall Adobe Flash - Without Administrator Rights by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
simple link list problem in else statement Minty C++ Forum 2 22-Feb-2007 03:30
Graphic problem in Unreal Tournament 2004 zerox Computer Software Forum - Games 10 09-Oct-2005 12:31
a significant problem after installing Xp mohammad Computer Software Forum - Windows 10 09-Aug-2005 07:03
Need a bit of help with switch() Caibre C Programming Language 5 12-Apr-2005 17:02
Problem Runnig Perl under Apache2 in Windows 2000 Server mig2000 Apache Web Server Forum 2 25-Oct-2004 06:20

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:22.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.