Hello again,
Thanks Tom Pheonix...I had put in a forward in place of backwards
slash...always a stupid mistake...one more question...I am able to substitute
the first value in my hash %id_global but doesn't substitute the rest I think
because it is only moving through the file once...I've successfully split it
into an array...how does one go about whiling through the elements of an array
(@TREE)?
cheers,
kathryn
#open treefile and while through it, substituting species name value when key
found in file.
open (TREE,$treefile)|| die "can't open tree file: $\n";
#my @TREE;
my $line;
while (<TREE>){
#split $_ on colon;
[EMAIL PROTECTED] = split (':',$_);
#print $TREE[0];
foreach my $code (keys %id_global){
#print "CODE->".$code."<-VALUE->".$id_global{$code}."\n";
$line = $_;
#if ($line =~ m/(.*)$code([\D])/) {print "MATCH"."
".$code."VALUE->".$id_global{$code}."<-\n";}
#else {print "NO MATCH"." ".$code."<-\n";} #works,matches all values w/right
val
#$line=~ s/(.*)$code([\D])/$1$id_global{$code}$2/g; #Yea!...now it
substitutes one value correctly
print $line.":";
}
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>