Sponsored Content
Top Forums Programming Perl: restrict perl from automaticaly creating a hash branches on check Post 302924130 by gandolf989 on Thursday 6th of November 2014 12:32:18 PM
Old 11-06-2014
Quote:
Is there a way to avoid such aromatic creation ????
I am new to Perl, but I have not found Perl to be very aromatic... ;-)

IMHO, I don't think you should check the branches for TRUE OR FALSE. Perl isn't very good at TRUE and FALSE.
Either you have data or you don't. So you should check for an empty sting and not worry about what the internal hash looks like.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl Hash

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

Perl Hash

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

perl (word by word check if a hash key)

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

Perl loop txt and check if a hash key

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

Perl Hash:Can not keep hash data in the same order that it was inserted

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

perl hash - using a range as a hash key.

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

Perl hash help

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

Compare values of hashes of hash for n number of hash in perl without sorting.

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

Perl: How to load some functions automaticaly, starting Perl inteructively (with -d -e 0)?

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

Restrict remote DB connection from PERL

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
warnings(3pm)						 Perl Programmers Reference Guide					     warnings(3pm)

NAME
warnings - Perl pragma to control optional warnings SYNOPSIS
use warnings; no warnings; use warnings "all"; no warnings "all"; use warnings::register; if (warnings::enabled()) { warnings::warn("some warning"); } if (warnings::enabled("void")) { warnings::warn("void", "some warning"); } if (warnings::enabled($object)) { warnings::warn($object, "some warning"); } warnings::warnif("some warning"); warnings::warnif("void", "some warning"); warnings::warnif($object, "some warning"); DESCRIPTION
The "warnings" pragma is a replacement for the command line flag "-w", but the pragma is limited to the enclosing block, while the flag is global. See perllexwarn for more information. If no import list is supplied, all possible warnings are either enabled or disabled. A number of functions are provided to assist module authors. use warnings::register Creates a new warnings category with the same name as the package where the call to the pragma is used. warnings::enabled() Use the warnings category with the same name as the current package. Return TRUE if that warnings category is enabled in the calling module. Otherwise returns FALSE. warnings::enabled($category) Return TRUE if the warnings category, $category, is enabled in the calling module. Otherwise returns FALSE. warnings::enabled($object) Use the name of the class for the object reference, $object, as the warnings category. Return TRUE if that warnings category is enabled in the first scope where the object is used. Otherwise returns FALSE. warnings::fatal_enabled() Return TRUE if the warnings category with the same name as the current package has been set to FATAL in the calling module. Otherwise returns FALSE. warnings::fatal_enabled($category) Return TRUE if the warnings category $category has been set to FATAL in the calling module. Otherwise returns FALSE. warnings::fatal_enabled($object) Use the name of the class for the object reference, $object, as the warnings category. Return TRUE if that warnings category has been set to FATAL in the first scope where the object is used. Otherwise returns FALSE. warnings::warn($message) Print $message to STDERR. Use the warnings category with the same name as the current package. If that warnings category has been set to "FATAL" in the calling module then die. Otherwise return. warnings::warn($category, $message) Print $message to STDERR. If the warnings category, $category, has been set to "FATAL" in the calling module then die. Otherwise return. warnings::warn($object, $message) Print $message to STDERR. Use the name of the class for the object reference, $object, as the warnings category. If that warnings category has been set to "FATAL" in the scope where $object is first used then die. Otherwise return. warnings::warnif($message) Equivalent to: if (warnings::enabled()) { warnings::warn($message) } warnings::warnif($category, $message) Equivalent to: if (warnings::enabled($category)) { warnings::warn($category, $message) } warnings::warnif($object, $message) Equivalent to: if (warnings::enabled($object)) { warnings::warn($object, $message) } See "Pragmatic Modules" in perlmodlib and perllexwarn. perl v5.12.1 2010-04-26 warnings(3pm)
All times are GMT -4. The time now is 02:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy