![]() |
![]() |
8 Einträge, 1 Seite |
1 2 3 4
open(my $bigfile, '<', '/mein/grosse/datei') or die "Error opening file: $!"; my @data = <$bigfile>; close($bigfile);
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/perl
use strict;
use warnings;
open my $fh, '>', 'foo.txt' or die $!;
for (1..10) {
print $fh "$_ Perl slogan: Easy things should be easy,";
print $fh " and hard things should be possible.\n";
}
close $fh;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/perl
use strict;
use warnings;
open my $fh, '<', 'foo.txt' or die $!;
seek($fh, 0, 2);
print "File size: ", tell($fh), "\n";
print "Change file and press enter ....\n";
<STDIN>; # jetzt editiere die Datei
seek($fh, 0, 2);
print "New file size: ", tell($fh), "\n\n";
seek($fh, 0, 0);
print <$fh>;
close $fh;
1
2
3
4
5
6
7
#!/usr/bin/perl
use strict;
use warnings;
open my $fh, '>>', 'foo.txt' or die $!;
print $fh "hello world\n";
close $fh;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
File size: 791
Change file and press enter ....
New file size: 803
1 Perl slogan: Easy things should be easy, and hard things should be possible.
2 Perl slogan: Easy things should be easy, and hard things should be possible.
3 Perl slogan: Easy things should be easy, and hard things should be possible.
4 Perl slogan: Easy things should be easy, and hard things should be possible.
5 Perl slogan: Easy things should be easy, and hard things should be possible.
6 Perl slogan: Easy things should be easy, and hard things should be possible.
7 Perl slogan: Easy things should be easy, and hard things should be possible.
8 Perl slogan: Easy things should be easy, and hard things should be possible.
9 Perl slogan: Easy things should be easy, and hard things should be possible.
10 Perl slogan: Easy things should be easy, and hard things should be possible.
hello world
![]() |
![]() |
8 Einträge, 1 Seite |