10 Comments
Leave a comment
About Ron Savage
I try to write all code in Perl, but find I end up writing in bash, CSS, HTML, JS, and SQL, and doing database design, just to get anything done...
I try to write all code in Perl, but find I end up writing in bash, CSS, HTML, JS, and SQL, and doing database design, just to get anything done...
Why?
"elsif" works fine in Perl, Ruby, PL/SQL
Python/C preprocessor use "elif"
PHP uses "elseif"
point taken. This bit me in my "First Days of Perl". Long, long time ago.. ;-)
I was lucky(?) enough to start programming with Ruby, so the switch to "elsif" with Perl wasn't really an issue. "elseif" is very PHP-esque.. so I'm going to say no thank you to this one. However, I wouldn't mind "else if"
Interestingly, in Perl 5.16.1+ perldoc perlfunc lists
elseif
alongside elsif, and refers you to perldoc perlsyn (which contains no mention of it).PHP is not the only language to contain an
elseif
keyword. C pre-processors support#elseif
; SQL has it; most BASIC variants do (including VBScript and VB.NET); MATLAB too.Looks like it was introduced by this commit by RJBS.
If I didn't know better, this page would lead me to believe that
elseif
exists in Perl:http://perldoc.perl.org/functions/elseif.html
Looks like Perl at least knows about it.. I get this
elseif should be elsif at - line 2.
Hi All
$many x $thanx for the replies.
Reply-to: vsespb: It reduces pain, especially for beginners. No other reason needed :-).
And, it's version-dependent. I also get:
elseif should be elsif at - line 2.
and I'm using 5.14.2.
As soon as 5.18.2 comes out I'm upgrading to 'elseif' bliss (hopefully), even though I have /almost/ trained myself to always use elsif, and will need to stick to it in shipped modules (gasp). Looks like another pre-commit hook in git is on the cards.
Well, the re-install of N too many modules won't be funny. And yes I read that post a couple of years ago re copying from a pre-existing install, but with that sort of jump in versions, I'm re-compiling etc.
> Reply-to: vsespb: It reduces pain, especially for beginners. No other reason needed :-).
Why not "elif" then? (for those who moved from Python)
> I'm upgrading to 'elseif' bliss (hopefully),
That will make your code harder to read/maintain for Perl and Ruby programmers (like me).
> As soon as 5.18.2 comes out I'm upgrading to 'elseif' bliss (hopefully)
Why do you think "elseif" will be allowed in 5.18.2 ?
it's not allowed in 5.19.3