Geeze, these answers come in much faster than I can type...
I did want to check your use of an array... You're using hash access:

$array{0} = 'clk_n';

Shouldn't this be

$array[0] = 'clk_n';



-----Original Message-----
From: Prentice, Phillip R [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 16, 2001 12:37 PM
To: '[EMAIL PROTECTED]'
Subject: regular expression match?


Hello,

I am fairly new to perl and am having problems matching a specific
character.  I want to be able to match the "_" character at the end of a
string.  For example, asume I have an array of strings with the following
data:

 $array{0} = "clk_n"
 $array{1} = "test_in_6_"
 $array{2} = "clk_out"

I want to create a regular expression which will match $array{1} and not the
others in the array.  This is what I have so far.

 foreach (@array) {
  if(m/$\w+\_/) {
   print "Matched, $_\n";
  }
}

This isn't giving the results I want, instead it will match the "_"
character in the middle of the string as well as the end of the string.  Any
ideas or suggestions on how this can be done?  Thanks in advance,

-Phillip Prentice

Reply via email to