"John W. Krahn" schreef:
> my %hash;
>
> @hash{ @array } = ();
Example:
$ perl -MData::Dumper -wle '
my @array = qw/x t 3 u 77 y r/;
my %hash;
@hash{ @array } = ();
print Dumper(\%hash);
'
$VAR1 = {
'y' => undef,
'u' => undef,
'r' => undef,
Sharan Basappa wrote:
On Thu, Mar 20, 2008 at 9:19 PM, Andrew Curry <[EMAIL PROTECTED]> wrote:
%hash = map { $_ => 1 } @array;
is just a funny way to write
%hash = ();
foreach $_ (@array) {
$hash{$_} = 1;
On Thu, Mar 20, 2008 at 12:05 PM, Sharan Basappa
<[EMAIL PROTECTED]> wrote:
> ok. thats what I wanted to confirm. I my crude code, I was doing
> exactly that and was
> wondering if there is some other way to make an entry without really
> adding value.
> Maybe, perl has to do it internally but
On Thu, Mar 20, 2008 at 11:46 AM, Sharan Basappa
<[EMAIL PROTECTED]> wrote:
> Can you throw some light on this statement:
>
> my %hashset = map { $_ => 1 } @array;
snip
The map* function takes a block of code and a list to process. It
runs the block of code on every item in the list returning a l
$hash{$_} = 1;
>
>
> }
>
> -Original Message-
> From: Sharan Basappa [mailto:[EMAIL PROTECTED]
> Sent: 20 March 2008 15:47
> To: Chas. Owens
> Cc: Robert Leibl; Perl Beginners
> Subject: Re: find an entry in hash array
>
> Can you throw some light on th
008 15:47
To: Chas. Owens
Cc: Robert Leibl; Perl Beginners
Subject: Re: find an entry in hash array
Can you throw some light on this statement:
my %hashset = map { $_ => 1 } @array;
On Thu, Mar 20, 2008 at 9:14 PM, Chas. Owens <[EMAIL PROTECTED]>
wrote:
> On Thu, Mar 20, 2008 at 1
Can you throw some light on this statement:
my %hashset = map { $_ => 1 } @array;
On Thu, Mar 20, 2008 at 9:14 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> On Thu, Mar 20, 2008 at 11:35 AM, Sharan Basappa
>
> <[EMAIL PROTECTED]> wrote:
>
> > Well here is what I am trying to do.
> > I have an arr
On Thu, Mar 20, 2008 at 11:35 AM, Sharan Basappa
<[EMAIL PROTECTED]> wrote:
> Well here is what I am trying to do.
> I have an array (generated from somewhere) I would like to convert
> this into an associative array and then based on some other input
> I would like to see if an entry exists in
Well here is what I am trying to do.
I have an array (generated from somewhere) I would like to convert
this into an associative array and then based on some other input
I would like to see if an entry exists in the asso array. As you can see
the value does not really matter. What matters is whethe
i am sorry. I really meant asso array ..
On Thu, Mar 20, 2008 at 8:32 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
>
> On Thu, Mar 20, 2008 at 10:50 AM, Sharan Basappa
> <[EMAIL PROTECTED]> wrote:
> > Is there a way to find out if an entry exists in a hash array?
> > e.g. I have a hash array and
On Thu, Mar 20, 2008 at 10:50 AM, Sharan Basappa
<[EMAIL PROTECTED]> wrote:
> Is there a way to find out if an entry exists in a hash array?
> e.g. I have a hash array and another normal array. I would like loop
> though regular array and see if the entries defined in this array exist
> in hash
11 matches
Mail list logo