4 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/local/bin/perl -w
use strict;
our @bundle = ("Datei_1", "Datei2");
for(@bundle){
print "at begining: @bundle\n";
read_my_file($_);
}
sub read_my_file{
open(MODULES, $_) or die "Can't open $_: $!\n";
print "in subroutine: @bundle","\n"x2;
#while(defined(my $line = <MODULES>)){print $line," @bundle\n"; } # geht
while(<MODULES>){print "In file: $_","My files: @bundle\n"; }
close(MODULES);
print "at end of sr: @bundle\n";
}
print "@bundle\n$#bundle\n";
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!/usr/local/bin/perl use strict; use warnings; my @bundle = ("Datei_1", "Datei2"); for my $datei (@bundle){ print "at begining: @bundle\n"; read_my_file($datei); } sub read_my_file{ my ($file) = @_; open(MODULES, '<', $file) or die "Can't open $file: $!\n"; print "in subroutine: @bundle","\n"x2; while(my $line = <MODULES>){print "In file: $line","My files: @bundle\n"; } close(MODULES); print "at end of sr: @bundle\n$#bundle\n"; } print "@bundle\n";
4 Einträge, 1 Seite |