in reply to Regex Capture Fails (was: stupid $1)

Every time you use regular expression, you reset the variables $1..$9. Try reordering your code so that you get everything out of the first regular expression before executing another one.

You can also capture these variables by assigning the result of the bind to an array as in (untested):

my ($job, $set, $predlnr) = $_=~ /^' PJOB='(.*)' PSET='(.*)' PJNO='(.* +)' WORKDAY='/; $predlnr =~ s/^00//; $jobstation=$jobstations{$jset}; print "follows $jobstation\#$set.${job}_$predlnr\n\n\n";
--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';

Replies are listed 'Best First'.
•Re: Re: stupid $1
by merlyn (Sage) on Mar 04, 2003 at 20:58 UTC
      Plus, I can't have a $10?

      Update Sorry, merlyn, to clarify, I meant that the previous poster seems to think you only get a maximum of nine dollar-n variables. --

      “Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.”
      M-J D