in reply to Re^2: hash question
in thread hash question

this is my code
$first = shift@ARGV; $second = shift@ARGV; open (IN, "<$first"); open (IN2, "<$second"); open (OUT, ">NACCESS"); %naccess = map { /^\s+\S+\s+\S+\s+(\S+)/; ($1 => $_) } <IN2>; close (IN2); while (<IN>) { chomp; /^\s+(\S+)/; print OUT ($1) unless (exists($naccess{$1})); } close (IN);
IN2 FILE
1 59 49 0.0 0 100.0 0.0 1 60 50 0.0 0 100.0 0.0
IN FILE
112 104.35 141.94 115 22.34 29.13

Replies are listed 'Best First'.
Re^4: hash question
by ikegami (Patriarch) on Nov 22, 2004 at 03:39 UTC
    I echo ysth's comment. Maybe there's a problem opening one of the input files?
    open (IN, "<$first") or die("Can't open first input file: $!$/"); open (IN2, "<$second") or die("Can't open second input file: $!$/"); open (OUT, ">NACCESS") or die("Can't open output file: $!$/");
Re^4: hash question
by ysth (Canon) on Nov 21, 2004 at 22:30 UTC
    Works for me, but you may want to print OUT "$1\n" unless ... instead.