in reply to RegExp error PLEASE HELP!

A few comments to your code. I downloaded it and got it run with these mods:
sub splitAB { my $STRING = shift; my $PATTERN = shift; # when debugging "print is your friend" print "pattern in sub splitAB= $PATTERN\n"; ##### print "string in sub splitAB = $STRING\n"; ##### my @OUTPUT = split(/\Q$PATTERN\E/, $STRING, 2); ##### $a = $b = ''; if (@OUTPUT > 0) { $a = $OUTPUT[0]; } if (@OUTPUT > 1) { $b = $OUTPUT[1]; } } sub decodeURLstr { my $S = shift; return unescape( join(' ', split('\+', $S) ) ); ##### }
In splitAB, the "?" has meaning to the regex engine, the \Q and \E tells split not to pay attention to that. output with my modifications:
pattern in sub splitAB= ? string in sub splitAB = file:///c:/html/testing.html?P1=123&P2=%28%28B +LAH+BLAH+BLAH%29%29 pattern in sub splitAB= # string in sub splitAB = P1=123&P2=%28%28BLAH+BLAH+BLAH%29%29 R: P1 R: 123 R: P2 R: ((BLAH BLAH BLAH)) Process completed successfully
I guess that is what you wanted?
From looking at the code and the use of substr(), I am guessing that you have a C background? In Perl, the use of regex instead of substr is the norm. As you write more Perl, you will use regex more often. In addition, you will start using modules for common task like parsing a URI. You "rolled your own" without necessity. I can tell that a lot of work went into your code. But you made the job harder on yourself than need be. Pay attention to haukex's post.

Have a happy and safe 4th of July!

Update: Do not use $a or $b. These variables have special meaning to Perl in sort. Use of them will cause problems in code that sorts.

Update 2: perhaps

my @OUTPUT = split(/\Q$PATTERN\E/, $STRING, 2); ##### $a = $b = ''; if (@OUTPUT > 0) { $a = $OUTPUT[0]; } if (@OUTPUT > 1) { $b = $OUTPUT[1]; }
better written? as (comments about use of $a,$b not withstanding):
($a, $b) = split(/\Q$PATTERN\E/, $STRING, 2); ##### $a //= ''; #null string if undefined $b //= ''; #null string if undefined