why no syntax error?

From: Ronald Fischer (ronaldf_at_eml.cc)
Date: 11/30/04


Date: 30 Nov 2004 02:05:31 -0800

I recently wrote the following nonsense:

  if($arg = ~ /^\d{4}$/) { ... }

In case you don't see it immediately: I had erroneously typed a space between
the equal sign and the tilde.

To my surprise, this statement was executed without error message. $arg was set
to 294967295.

The tilde did bitwise complement of course, but on what? On a regexp? This
does not seem to make sense to me....

This was executed under Perl 5.6.1

Ronald



Relevant Pages

  • Re: why no syntax error?
    ... Ronald Fischer wrote in comp.lang.perl.misc: ... > I recently wrote the following nonsense: ... > the equal sign and the tilde. ... assigned to $arg. ...
    (comp.lang.perl.misc)
  • Re: why no syntax error?
    ... Ronald Fischer wrote: ... > The tilde did bitwise complement of course, ... On a regexp? ...
    (comp.lang.perl.misc)
  • Re: user id validation
    ... Is there any such way that this might be, perhaps, oh, a FAQ? ... Perl require that you have a shell installed that groks tildes. ... so you may have not known "tilde". ... and probably reading the entire FAQ at least bi-monthly. ...
    (perl.beginners)
  • Re: why no syntax error?
    ... ronaldf@eml.cc (Ronald Fischer) wrote: ... > space between the equal sign and the tilde. ... > The tilde did bitwise complement of course, ...
    (comp.lang.perl.misc)
  • Re: opening file for appending doesnt work for me
    ... tilde means "home directory" when programming in the shell. ... tilde means "tilde character" in a Perl string... ...
    (comp.lang.perl.misc)