On Thu, 20 May 2004 00:59:22 +0900
Ben Giddings <bg-rubytalk / infofiend.com> wrote:

> One of the few things that Perl still has that Ruby doesn't is this:
> 
> use strict;
> 
> $num = 3;
> $num += 2;
> if ($numb != 5) {
>      print "Foo!!\n";
> }
> % perl perl.pl
> Global symbol "$num" requires explicit package name at perl.pl line 3.
> Global symbol "$num" requires explicit package name at perl.pl line 4.
> Global symbol "$numb" requires explicit package name at perl.pl line
> 5. Execution of perl.pl aborted due to compilation errors.

A better example is that perl does exactly what you were asking for
otherwise (behavior when -c and -v are both supplied to the ruby
interpreter):

jenova ~ % cat -n what.pl
     1  $num = 3;
     2  $num += 2;
     3  if ($numb != 5) {
     4       print "Foo!!\n";
     5  }
jenova ~ % perl -cw what.pl
Name "main::numb" used only once: possible typo at what.pl line 3.
what.pl syntax OK
jenova ~ % 

-c catches compile issues, and -w adds in warning text.