Skip to content

Instantly share code, notes, and snippets.

@rram
Created July 25, 2022 19:22
Show Gist options
  • Save rram/e0a266b9ef80e009725e4787093471dd to your computer and use it in GitHub Desktop.
Save rram/e0a266b9ef80e009725e4787093471dd to your computer and use it in GitHub Desktop.
Add values on standard input
#!/usr/bin/perl -w
$sum = 0;
while (<>) {
chomp;
$sum += $_;
}
print "$sum\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment