Hi all,
just stumbeled over a strange behaviour of perl: When trying to
retrieve a non-existing value from a perl array, e.g. by saying
my $a = [1,2];
my $b = $$a[3][0];
then $a is modified to [1,2,[]].
Is this a feature I just don't understand or is it really a bug (as I
would suppose)?
Thanx in advance,
thoin 3 1464
thoin wrote: just stumbeled over a strange behaviour of perl: When trying to retrieve a non-existing value from a perl array, e.g. by saying
my $a = [1,2]; my $b = $$a[3][0];
then $a is modified to [1,2,[]].
Suppose you mean [1,2,undef,[]].
Is this a feature I just don't understand or is it really a bug (as I would suppose)?
I think it's called autovivification. One place where it is commented
on is
perldoc -f exists
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Gunnar Hjalmarsson <no*****@gunnar.cc> wrote in message news:<mK********************@newsb.telia.net>... thoin wrote: just stumbeled over a strange behaviour of perl: When trying to retrieve a non-existing value from a perl array, e.g. by saying
my $a = [1,2]; my $b = $$a[3][0];
then $a is modified to [1,2,[]].
Suppose you mean [1,2,undef,[]].
Yes, of course I do mean that :-) Is this a feature I just don't understand or is it really a bug (as I would suppose)?
I think it's called autovivification. One place where it is commented on is
perldoc -f exists
Phew, nice to see that it will be fixed in the future. I mean, nice to
see that I was right supposing this behaviour to be kind of wrong.
Thanks a lot for your hint!
Thoin
In article <94**************************@posting.google.com >, thoin
<ca******@web.de> wrote: Gunnar Hjalmarsson <no*****@gunnar.cc> wrote in message news:<mK********************@newsb.telia.net>... thoin wrote: just stumbeled over a strange behaviour of perl: When trying to retrieve a non-existing value from a perl array, e.g. by saying
my $a = [1,2]; my $b = $$a[3][0];
then $a is modified to [1,2,[]].
Suppose you mean [1,2,undef,[]].
Yes, of course I do mean that :-)
Is this a feature I just don't understand or is it really a bug (as I would suppose)?
I think it's called autovivification. One place where it is commented on is
perldoc -f exists
Phew, nice to see that it will be fixed in the future. I mean, nice to see that I was right supposing this behaviour to be kind of wrong.
Thanks a lot for your hint!
Thoin
The only thing "perldoc -f exists" says might be fixed in the future is
that "exists $$a[3][0]" may not create $$a[3] if it doesn't already
exist. The statement "$b = $$a[3][0]" will definitely create $$a[3] if
it doesn't exist now and forever more in the future.
FYI: this newsgroup is defunct. Please try comp.lang.perl.misc in the
future. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Josep |
last post by:
Hi,
I'd like to poll a database and get the table contents, as well as the field
names from that table. I've been to php.net but this time I cannot find
something helpful.
I can get the data,...
|
by: dave |
last post by:
Hello there,
I am at my wit's end ! I have used the following script succesfully to
upload an image to my web space. But what I really want to be able to do is
to update an existing record in a...
|
by: Belmin |
last post by:
I have an array. The array key is the id of the item (for example
categories, 91 is the ID of the category) all ID are not exactly in
date order, but they're added to the array in date order, how...
|
by: VM |
last post by:
In my Windows application, I load an ascii file into a tableX and set the
datagrid.DataSource = tableX. The problem begins when I try to retrieve the
data from the grid in order to process the...
|
by: tangus via DotNetMonster.com |
last post by:
Hello all, I'm really struggling with getting some Active Directory code to
work in ASP.NET. Can you please provide assistance? I am executing the
following code:
Dim enTry As DirectoryEntry =...
|
by: 4Ankit |
last post by:
hello all, i am having some difficulty retrieving information from my
form. I want to add content in my table but the content i want to add
to the table is what the user inputs in my form.
...
|
by: bmallett |
last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
|
by: ADezii |
last post by:
One question which pops up frequently here at TheScripts is: 'How do I retrieve data from a Recordset once I've created it?' One very efficient, and not that often used approach, is the GetRows()...
|
by: ADezii |
last post by:
Last Tip, we demonstrated the technique for retrieving data from a DAO Recordset, and placing it into a 2-dimensional Array using the GetRows() Method. This week, we will cover the same exact Method...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |