in reply to Unexpected effect of -w with undef
You are giving Perl the code w to execute and the filename if (undef() eq undef()) {print "true" }else{ print "false"} as an argument to it. You probably wanted to say -we… Most of perl's switches are order sensitive.
strict catches this, FWIW:
$ perl -Mstrict -ew 'if(undef() eq undef()){print "true"}else{print "f +alse"}' Bareword "w" not allowed while "strict subs" in use at -e line 1. Execution of -e aborted due to compilation errors. $ perl -Mstrict -we 'if(undef() eq undef()){print "true"}else{print "f +alse"}' Use of uninitialized value in string eq at -e line 1. Use of uninitialized value in string eq at -e line 1. true
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unexpected effect of -w with undef
by DrWhy (Chaplain) on Dec 22, 2004 at 16:37 UTC | |
by Aristotle (Chancellor) on Dec 22, 2004 at 16:41 UTC | |
by gellyfish (Monsignor) on Dec 22, 2004 at 16:43 UTC | |
by merlyn (Sage) on Dec 22, 2004 at 16:45 UTC | |
by Aristotle (Chancellor) on Dec 22, 2004 at 16:45 UTC |