develooper Front page | perl.perl5.porters | Postings from September 2000

[PATCH pod/perlop.pod] Documentation glitch in magic autoincrement.

From:
abigail
Date:
September 26, 2000 10:38
Subject:
[PATCH pod/perlop.pod] Documentation glitch in magic autoincrement.
Message ID:
20000926173614.4356.qmail@foad.org
The documentation says that for strings matching /^[a-zA-Z]*[0-9]*$/
magic autoincrement is performed. However, no magic is performed on
"foo\n", which does match /^[a-zA-Z]*[0-9]*$/. Magic autoincrement is
performed on strings matching /^[a-zA-Z]*[0-9]*\z/.

Abigail

*** perlop.pod.orig	Thu Sep  7 14:46:27 2000
--- perlop.pod	Tue Sep 26 13:31:36 2000
***************
*** 119,125 ****
  a numeric context, you get a normal increment.  If, however, the
  variable has been used in only string contexts since it was set, and
  has a value that is not the empty string and matches the pattern
! C</^[a-zA-Z]*[0-9]*$/>, the increment is done as a string, preserving each
  character within its range, with carry:
  
      print ++($foo = '99');	# prints '100'
--- 119,125 ----
  a numeric context, you get a normal increment.  If, however, the
  variable has been used in only string contexts since it was set, and
  has a value that is not the empty string and matches the pattern
! C</^[a-zA-Z]*[0-9]*\z/>, the increment is done as a string, preserving each
  character within its range, with carry:
  
      print ++($foo = '99');	# prints '100'



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About