Rob Dixon wrote:
>
> I don't think so. $#array returns the index of the last existent element of
> the
> array. The one which pop() will delete and return, and the one after which
> push() will add an element.
>
> I'm not sure what you mean about 'while', but an array evaluates as true if it
> h
> This distinction between canonical existence and logical existence--or
> perhaps more properly the distinction between the existence of an
> element and of a position--is important because, while useful, the
> distinction does have implications for the value of $#array, the
> return value of scal
Jay Savage wrote:
> On Wed, Oct 8, 2008 at 11:24 AM, Rob Dixon <[EMAIL PROTECTED]> wrote:
>>
>> The return value of exists() is the definition of whether an array or hash
>> elements exists. It does exactly what it is documented to do and does not
>> lie.
>>
>> The idea of non-existent mid-range a
Jay Savage wrote:
On Wed, Oct 8, 2008 at 11:24 AM, Rob Dixon <[EMAIL PROTECTED]> wrote:
Jay Savage wrote:
On Tue, Oct 7, 2008 at 4:09 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
John W. Krahn wrote:
Incorrect, delete does not remove array elements:
$ perl -le'use Data::Dumper; my @a = "a".."d";
On Wed, Oct 8, 2008 at 11:24 AM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> Jay Savage wrote:
>> On Tue, Oct 7, 2008 at 4:09 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
>>> John W. Krahn wrote:
Incorrect, delete does not remove array elements:
$ perl -le'use Data::Dumper; my @a = "a"..
Jay Savage wrote:
> On Tue, Oct 7, 2008 at 4:09 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
>> John W. Krahn wrote:
>>>
>>> Incorrect, delete does not remove array elements:
>>>
>>> $ perl -le'use Data::Dumper; my @a = "a".."d"; delete $a[1]; print
>>> Dumper [EMAIL PROTECTED]'
>>> $VAR1 = [
>>>
On Tue, 2008-10-07 at 22:01 -0400, Jay Savage wrote:
> On Tue, Oct 7, 2008 at 4:09 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> > John W. Krahn wrote:
> [snip]
> >> Incorrect, delete does not remove array elements:
> >>
> >> $ perl -le'use Data::Dumper; my @a = "a".."d"; delete $a[1]; print
> >> Dump
On Tue, Oct 7, 2008 at 4:09 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> John W. Krahn wrote:
[snip]
>> Incorrect, delete does not remove array elements:
>>
>> $ perl -le'use Data::Dumper; my @a = "a".."d"; delete $a[1]; print
>> Dumper [EMAIL PROTECTED]'
>> $VAR1 = [
>>'a',
>>
On Tue, 2008-10-07 at 21:09 +0100, Rob Dixon wrote:
> Incorrect, delete does not remove array elements:
> >
> > $ perl -le'use Data::Dumper; my @a = "a".."d"; delete $a[1]; print
> > Dumper [EMAIL PROTECTED]'
> > $VAR1 = [
> >'a',
> >undef,
> >'c',
> >
John W. Krahn wrote:
> Rob Dixon wrote:
>> loody wrote:
if( exists $data{$key} ){
print "\t\$data{$key} exists\n";
>>> thanks for your kind help.
>>> Could I get the conclusion that exists is only used for determining
>>> the element of hash and arrays?
>>> appreciate your help,
>> Co
Rob Dixon wrote:
loody wrote:
if( exists $data{$key} ){
print "\t\$data{$key} exists\n";
thanks for your kind help.
Could I get the conclusion that exists is only used for determining
the element of hash and arrays?
appreciate your help,
Consider this program.
use strict;
use warning
loody wrote:
>> if( exists $data{$key} ){
>>print "\t\$data{$key} exists\n";
>
> thanks for your kind help.
> Could I get the conclusion that exists is only used for determining
> the element of hash and arrays?
> appreciate your help,
Consider this program.
use strict;
use warnings;
tails see:
http://perldoc.perl.org/functions/exists.html
> Message du 07/10/08 05:05
> De : "loody"
> A : "Mr. Shawn H. Corey"
> Copie à : "Raymond Wan" , "Perl beginners"
> Objet : Re: How to check empty hash value properly?
>
>
&g
> if( exists $data{$key} ){
>print "\t\$data{$key} exists\n";
Hi:
thanks for your kind help.
Could I get the conclusion that exists is only used for determining
the element of hash and arrays?
appreciate your help,
miloody
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
loody wrote:
Dear all:
Hello,
I want to use hash to keep my records.
But before using it, I want to determine whether the value of the key exist?
perldoc -q "What.s the difference between .delete. and .undef. with hashes"
John
--
Perl isn't a toolbox, but a small machine shop where you
ca
On Mon, 2008-10-06 at 22:35 +0900, Raymond Wan wrote:
> Try:
>
> if (defined $hash{$key}) {
> ...
>
Defined is not the same as exists.
#!/usr/bin/perl
use strict;
use warnings;
my %data = (
b => undef,
c => 1,
);
for my $key ( qw( a b c ) ){
print "\$key = $key\n";
if( exists $data{$
Hi Miloody,
Try:
if (defined $hash{$key}) {
...
Ray
loody wrote:
Dear all:
I want to use hash to keep my records.
But before using it, I want to determine whether the value of the key exist?
Below is my source code:
if($hash{$key} eq "")
{
print "the value of the $key is empty\n";
> Message du 06/10/08 15:25
> De : "loody"
> A : "Perl beginners"
> Copie à :
> Objet : How to check empty hash value properly?
>
>
> Dear all:
> I want to use hash to keep my records.
> But before using it, I want to determine whether the value
Dear all:
I want to use hash to keep my records.
But before using it, I want to determine whether the value of the key exist?
Below is my source code:
if($hash{$key} eq "")
{
print "the value of the $key is empty\n";
$hash{$key}=1;
}
else
{
$hash{$key}++;
}
It works but I wi
Suvajit Sengupta wrote:
> Hi,
Hello,
> How can I test whether a hash is empty or not ?
> For e.g: I have reference to a hash , say $preCommand and I get
> $preCommands as {} ,
> Its an empty hash, but it exists and is also defined.
> I need to check whether the hash is
Thanx, Beau ..it worked !!
Regards,
Suvajit
Beau E. Cox wrote:
Hi Suvajit Sengupta -
At 2005-11-16, 01:32:31 you wrote:
Hi,
How can I test whether a hash is empty or not ?
For e.g: I have reference to a hash , say $preCommand and I get
$preCommands as {} ,
Its an
Hi Suvajit Sengupta -
At 2005-11-16, 01:32:31 you wrote:
>Hi,
> How can I test whether a hash is empty or not ?
>For e.g: I have reference to a hash , say $preCommand and I get
> $preCommands as {} ,
> Its an empty hash, but it exists and is also defined.
>I need to ch
);
If the output is VAR1= {};
Then there are no entries in the has tables
HTH
Regards,
Shaman
-Original Message-
From: Suvajit Sengupta [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 16, 2005 4:33 PM
To: Perl Beginners List
Subject: Check empty hash
Hi,
How can I test whether a
Hi,
How can I test whether a hash is empty or not ?
For e.g: I have reference to a hash , say $preCommand and I get
$preCommands as {} ,
Its an empty hash, but it exists and is also defined.
I need to check whether the hash is empty or not.
Does anyone has any clue ?
Re
24 matches
Mail list logo