in reply to Regexp conundrum

use of unintialised value in pattern match (m//)... An undefined value was used as if it were already defined

You know, it is helpful if you indicate where the warning occurs.

my $pattern1 =~ /(word)-(spacing):\s*[\d]+px/; # word spacing regexp my $pattern2 =~ /(letter)-(spacing):\s*[\d]+px/; # letter spacing re +gexp

What's that supposed to do? You are matching against undefined variables.

if(/$pattern1 && $pattern2/)

You haven't defined $pattern1 and $pattern2 yet. But if you do, the code above most likely doesn't do what you think it does.

Abigail

Replies are listed 'Best First'.
Re: Re: Regexp conundrum
by Tricky (Sexton) on Aug 22, 2003 at 10:15 UTC
    How may I initialise the variables? A literal string within quotes? Much of the code I wrote didn't make much sense, so I've cut the unnecessary stuff out. Live and learn... Richard
      If the intention is to later interpolate them into a regexp, I'd go for a literal string. A qr construct works too, but that may be less efficient (it depends on how the interpolation happens).

      Abigail