Thread Weitergabe von Variablen an CGI-Skript (6 answers)
Opened by gmafx at 2010-10-22 21:50

FIFO
 2010-10-23 09:59
#142131 #142131
User since
2005-06-01
469 Artikel
BenutzerIn

user image
2010-10-22T19:50:20 gmafx
Code: (dl )
1
2
3
4
5
6
7
8
9
10
@folders =  grep {/ome/}  readdir DIR;

$c=0;
foreach $folder (@folders)
{
$c++;
}
if ($c==0)
{
...


Ein Test auf ein leeres Array geht lesbarer:
Code (perl): (dl )
1
2
3
@folders =  grep {/ome/}  readdir DIR;
if (! @folders) {  # oder: if (scalar @folders == 0)
...


btw: use strict; use warnings; erspart extrem viel Ärger ;-)
Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it? -- Brian Kernighan: "The Elements of Programming Style"

View full thread Weitergabe von Variablen an CGI-Skript