11-08-2014
That's a documented behavior in Perl and is called "autovivification".
Check the stackoverflow website for the question "How do I disable autovivification in Perl?" for a detailed discussion and workarounds.
gandolf989 has a point here. Any reason you do *not* want the intermediate branches to be created? As long as they are empty and your existence checks return the values as expected, your program should be fine.
Autovivification in Perl is by design. It's not a bug; it's a feature. And I think it stems from Perl's tendency to go out of its way to make your text processing task easy.
For an in-depth technical discussion of why it works like that, what its advantages are and what problems it solves, check this link:
http://www.sysarch.com/Perl/autoviv.txt
This User Gave Thanks to durden_tyler For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
HI
I have a hash like this
$hashname->{$filesystem}->{'fsname'}=$filesystem;
How to get the values from this multilevel hash.
Thanks in advance... :) (1 Reply)
Discussion started by: Harikrishna
1 Replies
2. Shell Programming and Scripting
hi
i have two hash achi %disk1,%disk2 with( key, value) (key1,value1)
How to store it in another hash..
Plz replyyy.
Regards
Hari (1 Reply)
Discussion started by: Harikrishna
1 Replies
3. Shell Programming and Scripting
Hi,
Now i work in a code that
1-get data stored in the database in the form of hash table with a key
field which is the " Name"
2-in the same time i open a txt file and loop through it word by word
3- which i have a problem in is that :
I need to loop word by word and check if it is a... (0 Replies)
Discussion started by: eng_shimaa
0 Replies
4. UNIX for Advanced & Expert Users
Hi,
The task i have to do is to
1- create a database contains the Names .run the query and store results in hash make the Name field is the hash key
2- in the same time i have a txt which i will loop through it word by word and check for each word if a hash key ( compare it with the Names in... (0 Replies)
Discussion started by: eng_shimaa
0 Replies
5. Shell Programming and Scripting
Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below.
#!/usr/bin/perl
use warnings;
use Tie::IxHash;
use strict;
tie (my %programs, "Tie::IxHash");
while (my $line = <DATA>) {
chomp $line;
my(... (1 Reply)
Discussion started by: jgfcoimbra
1 Replies
6. Shell Programming and Scripting
Hi,
In Perl, is it possible to use a range of numbers with '..' as a key in a hash?
Something in like:
%hash = (
'768..1536' => '1G',
'1537..2560' => '2G'
);
That is, the range operation is evaluated, and all members of the range are... (3 Replies)
Discussion started by: dsw
3 Replies
7. Shell Programming and Scripting
Hi ,
i have the below code its working fine when i execute in unix , but its not working in windows could you pls explain me where i am going wrong.
This is the program
$data = { '1' => 'one' ,
'2' => 'two' ,
3 => 'three'
};
print "hello : $data->{'1'}... (2 Replies)
Discussion started by: ragilla
2 Replies
8. Shell Programming and Scripting
Hi,
I have an hashes of hash, where hash is dynamic, it can be n number of hash. i need to compare data_count values of all .
my %result (
$abc => {
'data_count' => '10',
'ID' => 'ABC122',
}
$def => {
'data_count' => '20',
'ID' => 'defASe',
... (1 Reply)
Discussion started by: asak
1 Replies
9. Programming
I would like to use Perl in 'interactive' mode (kind off), starting it by
> perl -d -e 0;
But I need to have some function be read on loading.
Also, it should not be for anyone who starting Perl or use it any how.
I did try to search, but not much result.
I have try a file '.perldb':... (1 Reply)
Discussion started by: alex_5161
1 Replies
10. Shell Programming and Scripting
I have PERL code to connect to Oracle database using DBI.
e.g.
$PERL -e "use DBI; DBI->connect(qw(DBI:Oracle:db111 testu testpass));"
by using DBI , if remote DB added to tnsnames.ora , I can connect using DBI . is there a way to restrict not to connect to remote DB using DBI ?
... (1 Reply)
Discussion started by: talashil
1 Replies
LEARN ABOUT DEBIAN
perlanet::trait::yamlconfig
Perlanet::Trait::YAMLConfig(3pm) User Contributed Perl Documentation Perlanet::Trait::YAMLConfig(3pm)
NAME
Perlanet::Trait::YAMLConfig - configure Perlanet through a YAML configuration file
SYNOPSIS
package MyPerlanet;
extends 'Perlanet';
with 'Perlanet::Traits::YAMLConfig';
my $perlanet = MyPerlanet->new_with_config(
configfile => 'whatever.yml'
);
$perlanet->run;
DESCRIPTION
Allows you to move the configuration of Perlanet to an external YAML configuration file.
Example Configuration File
title: planet test
description: A Test Planet
url: http://planet.example.com/
author:
name: Dave Cross
email: dave@dave.org.uk
entries: 20
opml: opml.xml
page:
file: index.html
template: index.tt
feed:
file: atom.xml
format: Atom
cache_dir: /tmp/feeds
feeds:
- url: http://blog.dave.org.uk/atom.xml
title: Dave's Blog
web: http://blog.dave.org.uk/
- url: http://use.perl.org/~davorg/journal/rss
title: Dave's use.perl Journal
web: http://use.perl.org/~davorg/journal/
- url: http://www.oreillynet.com/pub/feed/31?au=2607
title: Dave on O'Reillynet
web: http://www.oreillynet.com/pub/au/2607
METHODS
THIRTY_DAYS
The default length of caching, if caching options are present in the configuration
get_config_from_file
Extracts the configuration from a YAML file
AUTHOR
Oliver Charles, <oliver.g.charles@googlemail.com>
COPYRIGHT AND LICENSE
Copyright (c) 2010 by Magnum Solutions Ltd.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or,
at your option, any later version of Perl 5 you may have available.
perl v5.14.2 2012-03-17 Perlanet::Trait::YAMLConfig(3pm)