>>>>> "EL" == Erik Lewis <ele...@ngrl.org> writes:

  EL> On Feb 17, 2010, at 1:07 PM, Rob Dixon wrote:

  >>> $itemlocation = $_ =~ m/^UT(.*?)^/;

  >> my ($itemlocation) = $_ =~ m/\^UT(.*?)\^/;

  EL> Thanks Rob, that changed the result 

  EL> D20010102093000111R,1
  EL> D20010102093000111R,1


  EL> Which I guess is the true value of the match, any idea on how to
  EL> make it return the contents of the match?

are you sure you used his code? it will not return the boolean result
but the grabbed part. he fixed your regex by escaping the ^ chars which
normally match the begining of the string or line. the parens around the
variable are important as they put the regex into list context and that
will return the grabbed parts.

so show the code that you ran that got you the 1 values. i bet you
didn't put the parens in. you probably did escape the ^ chars as you are
getting a true match value unlike your original code.

also you don't need the $_ =~ as the regex will default to matching
against $_.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to