3.94.98.40 |    

Navigation

Google Advertisement

Erstellt eine HTML Tabelle in definierten Spalten und errechnet die Rest Anzeige.

colums
  1. #!/usr/bin/perl
  2.  
  3. my @array=(1..20);
  4.  
  5. my $cols=6; # Anzahl der Spalten...
  6. my $tr=0;
  7. my $td=0;
  8.  
  9.  
  10. print "<table border=\"0\">\n";
  11.  
  12. # Array loopen...
  13. foreach my $line(@array) {
  14.  
  15.         # Berechnung der Tabellen-Ausgabe
  16.         # ( $tr dient als Zeilen-Zaehler )
  17.         print "<tr>\n" if ($td==0);
  18.         $tr++;
  19.         print "\t<td>".$line."</td>\n";
  20.         $td++;
  21.  
  22.         if ($td==$cols) { print "</tr>\n"; $td=0; }
  23.  
  24. }
  25.  
  26. # Rest-Anzeige - Tebellen-Zellen mit <td> </td> fuellen
  27. if (($td > 0) && (($cols-$td) > 0)) {
  28.         for($tr=($cols-$td-1);$tr>=0;$tr--){
  29.                 print "\t<td> </td>\n";
  30.         }
  31.         print "\t</tr>\n";
  32. }
  33.  
  34. print "</table>\n";
Parsed in 0.002 seconds at 406.11 KB/s

Search
 
Full text search by name and content of a snippet.

User online
There are 5 users online.

Tags Cloud

Latest snippets
str2seconds
(Bash::Function)
is_integer
(Bash::Function)
file_rotate
(Bash::Function)
confirm
(Bash::Function)
is_workingtime
(Bash::Function)
last day of last month
(Bash::Snippets)
crypt_apr1_md5
(PHP::Function)
crypt_apr1_md5
(Perl::Function)
transparent
(CSS)
rfc2822Toiso8601
(PHP::Function)