http://qs321.pair.com?node_id=667469

Cody Pendant has asked for the wisdom of the Perl Monks concerning the following question:

So I'm teaching a Fundamental Programming class.

I tell my students to do:

$string = 'hello world'; print substr($string,0,5);
But what one guy does is:
$string = 'hello world'; print substr($string,O,5);
(with a letter O instead of a zero, in case you can't quite make it out).

The trouble is ... it still worked. Why is this? I guess it's parsing the unquoted string for number-like-ness, getting nothing and returning zero, which is all very well, but I've turned on warnings, and there isn't one!

UPDATE: I was wrong about the warnings! I feel rather embarrased. Running the code in a particular IDE didn't give a warning, but running it from the command line does.



Nobody says perl looks like line-noise any more
kids today don't know what line-noise IS ...