in reply to Generating a list of numbers from other lists
#!/usr/bin/perl use warnings; use strict; my $number_list = '950581.NumberList'; my $looking_for = '950581.LookingFor'; my %remember; open my $NUMBER_LIST, '<', $number_list or die "$number_list: $!"; while (<$NUMBER_LIST>) { next if /Th|^$/; # Skip text and empty lines my ($key, $value) = split; push @{ $remember{$key} }, $value; } close $NUMBER_LIST; open my $LOOKING_FOR, '<', $looking_for or die "$looking_for: $!"; while (<$LOOKING_FOR>) { chomp; for my $value (@{ $remember{$_} }) { print "$_ $value\n"; # Do your calculations here... } } close $LOOKING_FOR;
|
|---|