I am very grateful for all the useful explanations you have provided. As you know, I am very beginner of perl, i tried to modify your provided code, because it didn't worked for me. I can see the logic for your code. But please let me ask you something. Following of your code isn't giving any output when i use it for 25 files. Please tell me how to fix it.
#!/usr/bin/env perl
use strict;
use warnings;
use autodie;
my @files = glob 'pm_1206312_in*';
my %uniq;
{
open my $fh, '<', shift @files;
while (<$fh>) {
my ($k, $v) = split;
$uniq{$k} = $v;
}
}
for my $file (@files) {
my %data;
open my $fh, '<', $file;
while (<$fh>) {
my ($k, $v) = split;
$data{$k} = $v;
}
for (keys %uniq) {
delete $uniq{$_} unless exists $data{$_} and $uniq{$_} eq $dat
+a{$_};
}
}
printf "%s %s\n", $_, $uniq{$_} for sort keys %uniq;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|