
data345
Novice
Dec 4, 2009, 11:58 AM
Post #1 of 2
(948 views)
|
Why isn't this working?
|
Can't Post
|
|
This is driving me nuts. It worked at one time. It's not making it inside the "if ( $ary[1] eq $srchstr ) " Here's some sample data: lookup: CIU.RCMs.1TH-VIB1B-RST.OUT CIU.RCMs.1TI-SY100.OUT CIU.RMSCs.1AB-_ASH.OUT CIU.RMSCs.1AB-CST_HAUL.OUT CIU.RMSCs.1BA-FC110A-B.OUT CIU.RMSCs.1BA-FC110B-B.OUT CIU.RMSCs.1FC-CST_TON.OUT And the sample opc_tags1 is uploaded as an attachment (it's text, of course).
#!/usr/bin/perl open (INFILE, "<opc_tags1"); #open (OUTFILE, ">out1"); while (<INFILE>) { chomp; @ary = split /\t/; if ( ! $ary[26]) { open (LOOKUP, "<lookup_table"); while (<LOOKUP>) { $srchstr = $fullstr = $_; $srchstr =~ s/.+\.(.+)\..+/$1/; print "Before if: $ary[1]\t$srchstr\n"; if ( $ary[1] eq $srchstr ) { print "in loop $ary[1]\t$srchstr\n"; $ary[26] = $fullstr; goto LINE; } } LINE: close LOOKUP; print "$ary[1]\t$ary[26]\n"; } }
|