very very basic question
very very basic question
(OP)
I have never used perl before. I would like to state that from the offset.
ok I have been given an old system written in perl to update, the update is not all that difficult and I have gotton along pretty well on my programming fundementals, that is until now.
I am useing a case statement to find out if a number is within a certain range how can this be done?
will it be something like
case csconitm < 5
cprice = 12
case csconitm > 4 .AND. < 10
cprice = 13
case csconitm > 9
cprice = 19
any help is most appreciated
Best Regards
James
please bear in mind I have no books or help files.
ok I have been given an old system written in perl to update, the update is not all that difficult and I have gotton along pretty well on my programming fundementals, that is until now.
I am useing a case statement to find out if a number is within a certain range how can this be done?
will it be something like
case csconitm < 5
cprice = 12
case csconitm > 4 .AND. < 10
cprice = 13
case csconitm > 9
cprice = 19
any help is most appreciated
Best Regards
James
please bear in mind I have no books or help files.
RE: very very basic question
DO_CASE: {
if ($csconitm < 5)
{
$cprice = 12;
last DO_CASE;
}
if (($csconitm > 4) && ($csconitm < 10))
{
$cprice = 13;
last DO_CASE;
}
if ($csconitm > 9)
{
$cprice = 19;
last DO_CASE;
}
} # end of DO_CASE
[\tt]
...pretty much what the Camel book says.....
You can name your block what ever you like. DO_CASE was the first name in my head. If you have the Camel book, see 'case structure'. If you don't have it, I suggest you get it.
Programming Perl
Wall, Christiansen, and Schwartz
O'Reilly & Associates, Inc.
'hope this helps
keep the rudder amid ship and beware the odd typo