Advertisement
cd62131

substitute evaluate value

Nov 11th, 2017
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.32 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. open my $in, '<', 'text2' or die;
  5. my $h = {};
  6. while (<$in>) {
  7.   my @line = split;
  8.   $h->{$line[0]} = $line[1];
  9. }
  10. close $in;
  11. my $sum;
  12. my $dummy;
  13. while (<>) {
  14.   chomp;
  15.   $sum = 0;
  16.   ($dummy = $_) =~ s/./{$sum += $h->{$&}}/gee;
  17.   next if $sum <= 3;
  18.   print "$_ $sum\n";
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement