473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

autoincrement strangeness - please help!

I am learning Perl and was using the Wrox Learning Perl book that I
found on the web. The author was explaining the autoincrement operator
and try as I might I can't understand this behaviour. The line of code
read...

$a = "9z"; print ++$a, "\n";

Aparently Perl reads in the ranges a-z, A-Z, 0-9 and if it caps off a
range then it will add a digit on the leftmost side and go back to the
beginning of a range ...but i think I misunderstand this as I was
expecting...

munnki@localhost:> 00a

to be output to the shell, as opposed to

munnki@localhost:> 10

i thought that the 9 will have reached it's max and become two zeros
(the start of the next range) and the z would, having reached it's
upper bound, have become an 'a'.

I hope I don't sound too stupid and I know this probably isn't the
most important aspect of the language..but i don't fully understand
this...could someone explain...

thanx
munnki
Jul 19 '05 #1
2 2105
Munnki wrote:
I am learning Perl and was using the Wrox Learning Perl book that I
found on the web. The author was explaining the autoincrement operator
and try as I might I can't understand this behaviour. The line of code
read...

$a = "9z"; print ++$a, "\n";


[Problem with auto-increment magic]

"9z" does not match the pattern "/^[a-zA-Z]*[0-9]*\z/", therefore the magic
is switched off, and the string "9z" is treated as a number which happens to
have the numerical value 9.
Try "z9" instead and you will get the result you are expecting.

For further details please see "perldoc perlop".

jue
Jul 19 '05 #2
thanx Jurgen - i need to start learning about regular expressions and
such - i have been delaying it as all those strange symbols hurt my
eyes :(|)
thanx again
munnki :(|)
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marko Maehner | last post by:
Hi, I have a strange problem with my xml file. In the schema of this xml file I have set one column to autoincrement. When I enter the data in my xml file directly, the autoincrement-column gets...
2
by: RA | last post by:
Hi I have the following datarow that I want to add to a datatable. DataRow newRow = ds.Tables.NewRow (); newRow = Cache.ToString (); newRow = Cache.ToString (); ds.Tables.Rows.Add...
0
by: Neil | last post by:
Hi, I'm getting some strange results using the autoincrement column on my datatable. I'm populating a datatable with data from my database and displaying this in a datagrid. The first time I get...
6
by: Dennis | last post by:
I have set a DataTable and one of the columns I set "AutoIncrement" to True. I then populate the Table by setting the columns to values then add the row to the table. I inadverently set the...
1
by: Mike | last post by:
I have a form that has an embedded subform (Datasheet View) that are linked based on a 1-many ID field. I have a field (SET) in my embedded subform that I want to Autoincrement starting with...
1
by: Mistoffeles | last post by:
I need to make the key field on a subform autoincrement differently dependent on a seletion made in the main form. On the main form, there is a drop-down with a limited set of values, for example:...
4
by: Tim | last post by:
Hello All, I could use some help on an error that is just now popping it's head up. Seems that the autoincrement numeric has hit 32,767. The autoincrement is used in various locations in the...
2
by: PulkitZery | last post by:
Hello, I am trying to create a Dataset and save it to an XML file. I have one column “JobID” for which I have set the autoincrement property to true. Here is the function that creates and save the...
4
by: jrhitokiri | last post by:
i have been working on a project with an autoincrement column. as i tested continually, the increments reached about 2500. now, with the project finished, how do i reset the autoincrement counter...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.