[EMAIL PROTECTED] wrote:
How do I simplify the regex below so that it matches only the number 1, henceforth it should return false if I match $string with $match.

use strict;
use warnings;

my $string = "10 11 12 13 40";
my $match = 1;

if ($string =~/^$match | $match | $match$/g){

Do you possibly mean something like:

    my $match = qr(\b1\b);
    if ( $string =~ /$match/ ) {

which would be true for the string

    my $string = "10 11 1 13 40";

but not for your original string.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to