chyba

Honza Pazdziora adelton na informatics.muni.cz
Sobota Únor 20 11:47:35 MET 1999


> 
> Niekedy mi vyhadzuje Perl takuto chybu:
> Value of <HANDLE> construct can be "0"; test with defined() at
> pokus.pl line 65535.
> Neviete co to znamena? Taky riadok tam nemam a robi to pri obycajnom
> jednoduchom skripte. Niekedy ked je dlhsi program, to vypise aj dva razy.

No, mozna byste nam ten jednoduchy skript mohl ukazat.

V kazdem pripade jde ale o to, ze

     Value of %s can be "0"; test with defined()
         (W) In a conditional expression, you used <HANDLE>, <*>
         (glob), each(), or readdir() as a boolean value.  Each
         of these constructs can return a value of "0"; that
         would make the conditional expression false, which is
         probably not what you intended.  When using these
         constructs in conditional expressions, test their values
         with the defined operator.

Tedy neco jako while ($a = <JEZEK>) { } se Vam muze zaseknout na
prvnim radku s nulou. V praxi to neni az takovy problem, protoze tam
typicky mate jeste "\n". Kazdopadne je dobre se tou radou ridit a
obalit to

	while (defined($a = <JEZEK>)) { }

Doufam, ze to pomuze,

------------------------------------------------------------------------
 Honza Pazdziora | adelton na fi.muni.cz | http://www.fi.muni.cz/~adelton/
 make vmlinux.exe			-- SGI Visual Workstation Howto
------------------------------------------------------------------------


Další informace o konferenci Perl