in reply to regexp - how to embed a "/" within the executable part of the regexp when using /e

s/(\d+)C/($1*9/5)+32 . "F"/ge;

I like [] for matches, and {} for code. Maybe the Apocalypses inspired me...

s[ (\d+) C ] { $1 * 9 / 5 + 32 . 'F' }gex;

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.

  • Comment on Re: regexp - how to embed a "/" within the executable part of the regexp when using /e
  • Select or Download Code

Replies are listed 'Best First'.
Re: Re: regexp - how to embed a "/" within the executable part of the regexp when using /e
by diotalevi (Canon) on Sep 27, 2002 at 13:03 UTC

    I'm reconsidering my normal useage of both toothpicks and pipes. Of course - once you start writing your regular expressions more like a grammar then it starts to make sense to use balanced delimiters, stylisticly even. Of course grammars (using regular expressions, not Parse::RecDescent) are *still* fugly in perl5 but hey.