[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] FNG



At 09.22 -0500 1999.01.27, Troy_Davis wrote:
>You need to make one adjustment for this do what you intend:
>
>>$myEmail = ~ s/%40/@/g;
>
>should be
>
>$myEmail =~ s/%40/@/g;
>
>=~ is an operator. I'm not sure what = ~ does... Anyone want to comment
>on where 4294967295 comes from?

Since =~ is not being used, the regex is acting on $_, which has no value,
so returns 0 to ~, which is the unary bitwise negation operator.  So you
are doing ~ 0, which is the same as 2**32 - 1, which is 4294967295.

  #!perl -wl
  $x = ~ 0;
  $y = ~ '';
  $z = 2**32 - 1;
  print $x;
  print $y;
  print $z;

Returns:

  4294967295

  4294967295

It seems that the failed regex returns 0 in numeric context, else undef.
Interesting but apparently true.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch