Ja, die ist dann auch bearbeitet.
Warum testet ihr das nicht einfach mal? Also...
create.pl
#!/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;
read.pl
#!/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;
change.pl
#!/usr/bin/perl
use strict;
use warnings;
open my $fh, '>>', 'foo.txt' or die $!;
print $fh "hello world\n";
close $fh;
Dann wie folgt in zwei Fenstern vorgehen:
1. im ersten Fenster create.pl ausführen, um foo.txt anzulegen
2. im ersten Fenster read.pl ausführen und bei der Eingabeaufforderung warten
3. im zweiten Fenster change.pl ausführen
4. im ersten Fenster "Enter" drücken
und siehe da....
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
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.