RE: perl - a small reminder

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 5 Nov 2008 13:51:32 -0500

Nope, in perl it forces you to use braces even if you have one line, except
for if you use the prefix notation like this.
 
$a = 5 if($b != 3);

Take care,
Sina

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Lamar Upshaw
Sent: Wednesday, November 05, 2008 1:40 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: perl - a small reminder

I need a little reminder and clarity about "If Else" statements.
I only need to use the braces when there's more than one statement made 
based on the condition of the "if" statement, right?

if ($a > 0)
{
$b =1;
$c =2;
}

But, if only one statement is made, I don't need the braces?
if ($a >0)
$b = 1;

With All Respect,
Upshaw, Lamar T 

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: