S
shul
Hi,
I am curious. If I take !1 and put it into an array or hash, what
lives in that position?
I know that !1 is false, which can be represented by () or 0.
Well if I do this
my @arp = 1 .. 4;
my $len= $#arp;
print "length is $len\n";
my $out1 = ! 1;
push(@arp, $out1);
print "$arp[4]\n";
my $len= $#arp;
print "length is $len\n";
well clearly the @arp array is longer is longer, but I dont get
anything printed when I try to print
print " the value is $arp[4]\n";
it just prints
"the value is "
So what is that object at position $arp[4]?
What operator will identify what lives at $arp[4]?
Note if I push a new thing on to @arp it goes to the next position $arp
[5].
shouldn't it be 0 or maybe it really its just () ?
This came up while I was reading a article which discussed different
ways of selecting unique elements of an array, which used a ! operator
together with ++ on a hash.
I am curious. If I take !1 and put it into an array or hash, what
lives in that position?
I know that !1 is false, which can be represented by () or 0.
Well if I do this
my @arp = 1 .. 4;
my $len= $#arp;
print "length is $len\n";
my $out1 = ! 1;
push(@arp, $out1);
print "$arp[4]\n";
my $len= $#arp;
print "length is $len\n";
well clearly the @arp array is longer is longer, but I dont get
anything printed when I try to print
print " the value is $arp[4]\n";
it just prints
"the value is "
So what is that object at position $arp[4]?
What operator will identify what lives at $arp[4]?
Note if I push a new thing on to @arp it goes to the next position $arp
[5].
shouldn't it be 0 or maybe it really its just () ?
This came up while I was reading a article which discussed different
ways of selecting unique elements of an array, which used a ! operator
together with ++ on a hash.