> Note, the disagreement with awk and perl above for "0" despite my
> saying Perl was inspired by awk stems from awk being more subtle about
> its treatment of the string "0" being false; it is false when it
> comes from user input, e.g. the environment or read from a file, but
> as a constant in source code it's true!
It seems Larry was unaware of this subtleness when he wrote Perl's
a2p(1) awk-to-perl translator.
$ printf '%s\n' '0 f' '1 t' | awk '$1 && "0"'
1 t
$ printf '%s\n' '0 f' '1 t' | perl -e "$(a2p <<<'$1 && "0"')"
$
$ a2p <<<'$1 && "0"' | grep print
print $_ if $Fld[1] && '0';
$
Reported to Ubuntu's launchpad and upstream to perlbug.
Cheers, Ralph.
--
Next meeting: ???, ???day, 2012-11-?? 20:00
Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/
New thread on mailing list: mailto:[email protected]
How to Report Bugs Effectively: http://goo.gl/4Xue