Anthony_V
08-07-03, 14:10
| Hello every, I have two files that I want to compare some values between the two. File A rms_r4_4 3.8336e-05 rms_r4_43 7.526e-05 avg_r4_44 6.2331e-06 avg_r4_50 1.4547e-05 avg_r4_11 3.242e-10 ..... .... ..... File B avg_r4_31 0.0032727 rms_r4_31 0.0155373 avg_r4_5 rms_r4_5 0.0405308 avg_r4_12 7.71647e-16 ...... ..... ..... I like to take the name in file A and matched to file B then print out it's values. Here is the partial code: #!/usr/intel/bin/perl use strict; my (@names, @matches); open my $A, "/home/avo/rv_validation/com_ouput" || die "file not found\n"; while (my $line = <$A>) { my ($name, $current ) = split(/\s+/), $line, 2; push (@names, $name); } close ($A); open my $B, "/home/avo/rv_validation/net_output" || die "file not found\n"; while (my $line = <$B>) { my ($name, $current1 ) = split(/\s+/), $line, 2; push (@matches, $name ) if (grep /$name/, @names); } close ($B); print "$_\n" for (@matches); The error message I got when running this script are: Global symbol "line" requires explicit package name at comp_all.pl line 10. syntax error at comp_all.pl line 23, near ""$_\n" for " Execution of comp_all.pl aborted due to compilation errors. Can someone help me with this? thanks for the help in advance. Anthony |