Leser: 1
![]() |
|< 1 2 3 4 5 6 7 >| | ![]() |
63 Einträge, 7 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
package TestModul;
sub do_open {
local $_;
open FH,'<','./test.txt' or die $!;
while (<FH>) {
print;
}
close FH;
}
1;
1
2
3
4
5
6
7
8
9
10
use TestModul;
open FH,'<','./test.txt' or die $!;
while (<FH>) {
TestModul->do_open;
print;
}
close FH;
1
2
3
4
5
6
7
8
9
10
11
12
open( FH, $file1 ) or die $!;
my $filter = &GetFilter($filterFile);
my @lines = <FH>;
close( FH );
sub GetFilter {
my ($file) = @_;
open( FH, $file) or die $!; # schliesst das aeussere FH
my $filter = <FH>;
close(FH);
return $filter;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl
use strict;
use warnings;
open(FH,"test.txt") or die $!;
while(<FH>){
methode();
}
close FH;
sub methode{
open(FH,"test2.txt") or die $!;
close FH;
}
1
2
C:\Perl\community\studium>fileh.pl
readline() on closed filehandle FH at C:\Perl\community\studium\fileh.pl line 8.
1
2
3
4
5
my $content = do {
local $/; # slurp mode
open (my $FH, "<", $file) or die "Error in reading file '$file': $!\n";
<FH>;
}; # do
close $fh or die $!
![]() |
|< 1 2 3 4 5 6 7 >| | ![]() |
63 Einträge, 7 Seiten |