Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: can i concatenate various value to form a unique key

by JavaFan (Canon)
on Jul 03, 2009 at 10:17 UTC ( [id://777012]=note: print w/replies, xml ) Need Help??


in reply to can i concatenate various value to form a unique key

As explained else where in the thread, that has the potential to not be unique.

It's a little known feature that Perl actually supports autoconcatenation of strings used as hash keys, joining them together using $;, which by default contains "\034" which is rare enough that it's unlikely unwanted duplicates are formed. So, you can write:

my @value = @{$Config{$value1,$value2,$value3,$value4,$value5}};
without having to join them yourself.

This was how people did multilevel hashes using perl4.

For more details, see the perlvar entry about $;.

Replies are listed 'Best First'.
Re^2: can i concatenate various value to form a unique key
by Anonymous Monk on Jul 03, 2009 at 10:38 UTC
    i am initialize these variable with some default value and then will the same problem exists? and for the default key combination also hash have some value like
    my $value1 = 'x'; my $value2 = 'x'; my $value3 = 'x'; my $value4 = 'x'; ---- #code where actual value will be assigened to the variables and only $ +value2 didnt get assigned to any value so $value2='x' itself ---- my @value = @{$Config {'hai','x','there','bye'}};
    if my has have a value for thsi key also will it be an issue?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://777012]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-24 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found