Jeff Westman wrote:
> 
> Okay, this may sound pretty basic, but what is the qr// function used for?

It is used to compile a regular expression and store it in a scalar. 
Note that the value stored is NOT a simple text string.

$ perl -le'
my $x = qr/.*XX.*/;
my $y =  q/.*XX.*/;
print "$x\t" . ref $x;
print "$y\t" . ref $y;
'
(?-xism:.*XX.*) Regexp
.*XX.*


> I rarely see it used.  I've consulted perldoc perlre,

Try consulting perldoc perlop instead.  :-)

> and it still makes no sense.
> 
> Could someone give a simple, practical example of this in use?

If you need to use a variable in a regular expression it is usually more
efficient to compile it with qr// than to have perl interpolate and
compile it at run-time.



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to