[
Thread Prev][
Thread Next] >
Date Index
>
Thread Index
Re: Anzahl der Keys in einem Hash?
Wengatz Herbert -
Mon Nov 19 10:24:00 2001
Eike.Grote@consol.de wrote:
>
> Quoting Stefan `Sec` Zehl <sec@42.org>:
>
> > > %a=(4 => 1, 10 => 1);
> > > print scalar(keys(%a)),"\n";
> > > print scalar(%a),"\n";
> > > print scalar(%a)+0,"\n";
> >
> > Das ist aber kein gutes Beispiel :)
> >
> > | matrix:~>perl -e'
> > | %a=(4 => 1, 10 => 1);
> > | print scalar(keys(%a)),"\n";
> > | print scalar(%a),"\n";
> > | print scalar(%a)+0,"\n";
> > | '
> > | 2
> > | 2/8
> > | 2
>
> Dann haben wir unterschiedliche Hash-Funktionen...
>
> [prompt]> cat /tmp/test.pl
> %a=(4 => 1, 10 => 1);
> print scalar(keys(%a)),"\n";
> print scalar(%a),"\n";
> print scalar(%a)+0,"\n";
> [prompt]> perl /tmp/test.pl
> 2
> 1/8
> 1
>
> In meinem Falle Perl 5.6.1 unter Solaris 8.
Dann gibt es wirklich mehrere Versionen, denn bei mir sieht's so aus:
Perl, Version 5.7.2 unter Linux 2.2.19:
bash-2.03$ ./hash_keys
2
2/8
Argument "2/8" isn't numeric in addition (+) at ./hash_keys line 7.
2
bash-2.03$
(Ihr habt das "-w" vergessen... ;-) )
Woher das "1/8" und "1" unter Solaris 8 rührt, solltest Du mal die
Perl5-Porters fragen...
Ciao,
Herbert
--
Herbert Wengatz Phone MchP: +49 (0)89 / 636 - 47677
I&S IT PS 8
Siemens AG Mobile : +49 (0)160 / 8 85 16 85
Otto Hahn Ring 6 Fax MchP: +49 (0)89 / 636 - 47586
81738 Muenchen mailto:herbert.wengatz@mchr2.siemens.de
http://www.aida-ix.net
Next:
- Re: Anzahl der Keys in einem Hash?, (continued)
RE: Anzahl der Keys in einem Hash?,
Joerg, Harald