Thread umsortieren einer zahlenliste (41 answers)
Opened by climber at 2009-06-09 11:58

hlubenow
 2009-07-10 16:27
#123053 #123053
User since
2009-02-22
875 Artikel
BenutzerIn
[default_avatar]
Hallo,

es gibt bestimmte Funktionen, um in Perl mit Datum und Zeit umzugehen.
Dazu hab' ich mal ein Beispielskript geschrieben:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl

use warnings;
use strict;

# Without the brackets, too many functions would be exported
# into the main::-namespace:
use POSIX ();

# Print current time in central European format including seconds:
print POSIX::strftime("%H:%M:%S", localtime) . "\n";

# On Linux, you can read more about format-strings like "%H:%M:%S"
# by executing the shell-command "info date".

# Print today's date in central European format; the numbers of days and months
# below 10 are zero-padded (like in 09.08.2007):
print POSIX::strftime("%d.%m.%Y", localtime) . "\n";

# Print seconds since epoch (on Linux, epoch is 1.1.1970):
print time . "\n";

# Generate a time-list from seconds since epoch and print it:
my @tml = localtime;
print join(", ", @tml) . "\n";

# Print today's date in central European format using the time-list generated above;
# the numbers of days and months below 10 are blank-padded (like in 9.8.2007):

print $tml[3] . "." . ($tml[4] + 1) . "." . ($tml[5] + 1900) . "\n";

# Convert the time-tuple back to seconds since epoch:

print POSIX::mktime(@tml) . "\n";

das man auch auf meiner Seite findet.

HTH

View full thread umsortieren einer zahlenliste