>>>>> "TB" == Tim Bowden <tim.bow...@mapforge.com.au> writes:

  TB> On Mon, 2009-08-31 at 01:18 -0400, Uri Guttman wrote:

  >> do you know you can also get all the $1 values if you put the regex into
  >> list context? you can assign them all to an array or a list of scalars,
  >> etc.

  TB> Interesting.  *scratch head* Makes sense.  I'll have a play with it.
  TB> Looks like a good idea.

it is the only way to directly get all the $1 values without doing more
work. the @+ and @- vars are useful for some things too like getting the
text between the grabs and other stuff.

  >> and you shouldn't use $& and friends as they can slow down all your
  >> other s/// calls in your entire program. this has been covered many
  >> times so you can search for why.

  TB> Yes, I was aware of that, but thanks for the reminder.  In this case
  TB> it's not a problem, because the script is purely for the purpose of
  TB> testing any one given regex that I'm wanting to use elsewhere and so
  TB> long as it doesn't take more than a few seconds to process I'm not
  TB> worried.  ;-)

you should keep the same code discipline for little throwaways as for
production system (well, close to the same). it will strengthen your
coding habits and style.

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