7 Einträge, 1 Seite |
my $bytes = scalar(@bytes);
1 2 3 4 5
#!/usr/bin/perl use strict; use warnings; my $data = join '',<STDIN>; my $bytes = length($data);
1
2
3
4
5
6
7
open( my $FH, "<", $fileOrPipeOrWhatever )
or die $!;
my $fileSize = 0;
while( my $line = <$FH> ) {
$fileSize += length($line);
} # while
close( $FH );
1
2
3
4
5
6
7
8
9
10
11
use File::stat;
open( my $FH, "<", $fileOrPipeOrWhatever )
or die $!;
my $fileSize = 0;
my $blockSize = stat($FH)->blksize;
my $len;
while($len = sysread($FH, my $buf, $blockSize) ) {
$fileSize += $len;
} # while
die $! unless defined $len;
close( $FH );
7 Einträge, 1 Seite |