Re: entering regular expressions from the keyboard

2007-08-24 Thread Dr.Ruud
Jay Savage schreef: > Dr.Ruud: >>> Christopher Spears: #print $regexp; >> >> Make that >> print qr/$regexp/; > > Not sure where your headed with this. My headed? :) It was an alternative for the commented "debug" line. > First, OP wants to print the input back to the user. And I pre

Re: entering regular expressions from the keyboard

2007-08-23 Thread Jay Savage
On 8/23/07, Jay Savage <[EMAIL PROTECTED]> wrote: > That means the regex is actually being compiled twice. It probably > doesn't, though, make sense to compile the regex before entering the > loop, so perhaps something like: Make that *does* make sense. -- j --

Re: entering regular expressions from the keyboard

2007-08-23 Thread Jay Savage
On 8/21/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: > Jeff Pang schreef: > > Christopher Spears: > > >> print "Enter regular expression: "; > >> chomp(my $regexp = ); > > > > $regexp = quotemeta($regexp); > > Since it specifically asks for a regular expression, I would definitely > not do quotemeta(). >

Re: entering regular expressions from the keyboard

2007-08-21 Thread Dr.Ruud
Jeff Pang schreef: > Christopher Spears: >> print "Enter regular expression: "; >> chomp(my $regexp = ); > > $regexp = quotemeta($regexp); Since it specifically asks for a regular expression, I would definitely not do quotemeta(). >> #print $regexp; Make that print qr/$regexp/; -- Affijn,

Re: entering regular expressions from the keyboard

2007-08-21 Thread Paul Lalli
On Aug 20, 11:28 pm, [EMAIL PROTECTED] (Christopher Spears) wrote: > I'm working on the second exercise of the second > chapter. I'm supposed to write a program that asks > the user to type a regular expression. The program > then uses the regular expression to try to find a > match in the direct

Re: entering regular expressions from the keyboard

2007-08-20 Thread Mr. Shawn H. Corey
Christopher Spears wrote: Hi! I'm trying to get back into Perl again by working through Intermediate Perl. Unfortunately, the Perl part of my brain has atrophied! I'm working on the second exercise of the second chapter. I'm supposed to write a program that asks the user to type a regular

Re: entering regular expressions from the keyboard

2007-08-20 Thread Jeff Pang
-Original Message- >From: Christopher Spears <[EMAIL PROTECTED]> >Sent: Aug 21, 2007 11:28 AM >To: beginners@perl.org >Subject: entering regular expressions from the keyboard > >Hi! > >I'm trying to get back into Perl again by working >through Intermediate Perl. Unfortunately, the Perl >