Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created August 13, 2020 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnthn/cdeb4813801896b7afbba3e0d66bca50 to your computer and use it in GitHub Desktop.
Save jnthn/cdeb4813801896b7afbba3e0d66bca50 to your computer and use it in GitHub Desktop.
my $fh = open "longfile", :w;
for ^1_000_000 {
$fh.say("xyz" x 60);
}
$fh.close;
my $fh = open "longfile";
my $chars = 0;
for $fh.lines { $chars = $chars + .chars };
$fh.close;
say $chars
open my $fh, "<:encoding(UTF-8)", "longfile";
my $chars = 0;
while ($_ = <$fh>) { chomp; $chars = $chars + length($_) };
close $fh;
print "$chars\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment