Perl Lesson Learned Today
$ perl -le 'sub x { 1 }; print x + 1'
1
$ perl -le 'sub x() { 1 }; print x + 1'
2
Yikes. Scares me a little I didn’t know that. In case it’s not clear what’s going on in the first one, that’s getting evaluated as x(+1).
$ perl -le 'sub x { 1 }; print x + 1'
1
$ perl -le 'sub x() { 1 }; print x + 1'
2
Yikes. Scares me a little I didn’t know that. In case it’s not clear what’s going on in the first one, that’s getting evaluated as x(+1).