-----Original Message----- >From: Christopher Spears <[EMAIL PROTECTED]> >Sent: Aug 21, 2007 11:28 AM >To: [email protected] >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 >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 expression. The program >then uses the regular expression to try to find a >match in the directory that I hard coded into the >program. Here is what I have so far: > >#!/usr/bin/perl -w >use strict; > >print "Enter regular expression: "; > >chomp(my $regexp = <STDIN>); >#print $regexp;
$regexp = quotemeta($regexp); See also perldoc -f quotemeta. -- Jeff Pang - [EMAIL PROTECTED] http://home.arcor.de/jeffpang/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
