El Jul 19, 2007, a las 12:19 AM, Joseph L. Casale escribió:

Interesting,
I see from your regexp you use a \A and \z, from Perldoc this means:
\A      Match only at beginning of string
\z      Match only at end of string

I am not sure I understand this requirement?

^ and $ depend on flags, and $ allows an optional trailing newline. When I want to match a complete string exactly, I tend to use \A and \z because they convey that intention clearly.

If your code processes line by line and splits on whitespace, \A ... \z is equivalent to ^ ... $.

In my case, I am checking an array of 3 scalars. Does this make sense:
next unless @data =~ /$RE {num}{real}/;
Does the regexp know to evaluate each element in the array implicitly? Or do I need to tell it this?

Detecting whether something holds in an array is the job of grep:

  my $numbers = grep /\A$RE{num}{real}\z/, @data;
  next unless $numbers == @data;

-- fxn


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to