Re: [MacPerl] Setting regex switch programmaticaly

2001-03-06 Thread Chris Nandor
At 09:39 +0100 2001.03.06, Bart Lateur wrote: >On Mon, 05 Mar 2001 21:54:26 +0100, Giorgio Valoti wrote: > >>As a real newbie I have to ask why should I avoid the eval... Also, in >>which situation you would recommend its use, other than trapping otherwise >>fatal errors? > >Because the "code" rea

Re: [MacPerl] Setting regex switch programmaticaly (now OT)

2001-03-06 Thread Giorgio Valoti
Bart Lateur wrote: > > >Content-Type: application/x-pkcs7-signature; name="smime.p7s" > >Content-Description: S/MIME Cryptographic Signature > > Please don't do that. There's no need to send a useless (to us) 1.7kb > attachment to every recipient, and store it forever in the mail > archives. I w

Re: [MacPerl] Setting regex switch programmaticaly

2001-03-06 Thread Bart Lateur
On Mon, 05 Mar 2001 21:54:26 +0100, Giorgio Valoti wrote: >As a real newbie I have to ask why should I avoid the eval... Also, in >which situation you would recommend its use, other than trapping otherwise >fatal errors? Because the "code" really is a string, and it needs to be recompiled every

Re: [MacPerl] Setting regex switch programmaticaly

2001-03-06 Thread Giorgio Valoti
Chris Nandor wrote: > At 10:50 +0100 2001.03.05, Bart Lateur wrote: > >eval() should still work. > > > > eval("\$something =~ m/regex/$switch") > > My preferred method, FWIW, is: > > my $result; > if ($switch eq 'i') { > $result = $something =~ m/regex/i; >

Re: [MacPerl] Setting regex switch programmaticaly

2001-03-05 Thread Scott R. Godin
on 03/05/2001 01:47 PM, Ronald J Kimball at [EMAIL PROTECTED] wrote: > > In 5.004/MacPerl, try this instead: > > $_ = 'Yet Another Perl Hacker'; > $switch = 'i'; > print /(?$switch)PERL/'Y':'N'; > > > (?imsx) was in 5.004; (?imsx:PATTERN) was added later. > > > Ronald you forgot an additi

Re: [MacPerl] Setting regex switch programmaticaly

2001-03-05 Thread Ronald J Kimball
On Mon, Mar 05, 2001 at 10:50:07AM +0100, Bart Lateur wrote: > In 5.6.0: > > $_ = 'Yet Another Perl Hacker'; > $switch = 'i'; > print /(?$switch:PERL)/?'Y':'N'; > --> > Y > > But, it doesn't work in 5.004/MacPerl. > In 5.004/MacPerl, try this instead: $_ = 'Yet Another

Re: [MacPerl] Setting regex switch programmaticaly

2001-03-05 Thread Chris Nandor
At 10:50 +0100 2001.03.05, Bart Lateur wrote: >eval() should still work. > > eval("\$something =~ m/regex/$switch") My preferred method, FWIW, is: my $result; if ($switch eq 'i') { $result = $something =~ m/regex/i; } else { $result =

Re: [MacPerl] Setting regex switch programmaticaly

2001-03-05 Thread Bart Lateur
On Mon, 05 Mar 2001 10:33:05 +0100, Giorgio Valoti wrote: >Hi all, >perhaps it's a silly question but what I'd like to do is something like: > ># >#pseudocode ># >my $switch = 'i'; >if ($something =~ m/regex/$switch) { >... >} > >I tried with eval and double quoting interpolation with no luck. Is

[MacPerl] Setting regex switch programmaticaly

2001-03-05 Thread Giorgio Valoti
Hi all, perhaps it's a silly question but what I'd like to do is something like: # #pseudocode # my $switch = 'i'; if ($something =~ m/regex/$switch) { ... } I tried with eval and double quoting interpolation with no luck. Is something like this possible? TIA -- Giorgio Valoti Magnetic Media Ne