Shivendra Agarwal Shivendra Agarwal - 1 year ago 125
Perl Question

Perl: elsif, Python: elif, C/ CPP/ Java: else if

This was the code giving me errors on Perl.




...
else if (exists($framename{$presFrame}) && (($framename{$presFrame}) < = $j))
...





here
framename
is a hash and
presFrame
is a key present in
framename


Edit:

Realized if/ else syntax is a bit different in Perl as mentioned in correct answer.

Answer Source

I think you mean:

elsif (exists($framename{$presFrame}) && (($framename{$presFrame}) <= $j))

otherwise you'd need braces on the else clause, i.e.

else {
  if(...) {
     ...
  }
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download