Re: question about data structures - what does $# mean?
- From: "Dr.Ruud" <rvtol+news@xxxxxxxxxxxx>
- Date: Sat, 30 Aug 2008 17:21:45 +0200
Ed schreef:
#!/usr/bin/perl -w
Get rid of the "-w". Add:
use strict;
use warnings;
my $d = {sid=>["lll"]};
print $#{$d->{sid}}."\n";
There is no need to concatenate, you can just write
print $#{ $d->{sid} }, "\n";
I expect this to print 1, but it prints 0.
Add a line with "$[ = 1;" somewhere above it, and it will.
But you should really read perlvar first.
--
Affijn, Ruud
"Gewoon is een tijger."
.
- References:
- Prev by Date: Re: question about data structures - what does $# mean?
- Next by Date: Re: trouble writing a setuid script
- Previous by thread: Re: question about data structures - what does $# mean?
- Next by thread: FAQ 6.16 How can I do approximate matching?
- Index(es):
Relevant Pages
|