my first "serious" perl module is simple parse of IBM MVS JCL. In the
following routine, I'm looking for program name in a parm line that may be
of the form:
PARM='BMP,WEAAC202,WEAAC202,,,,,,,,80,,,,,,' 
(in this instance it's supposed to go after the first 'WEAAC202')

#!/usr/bin/perl
use strict;
use warnings;
my $F=0;
.......... Main Part of Program Here .................
sub PARin
{
if ($_ =~ /PARM=\(\'[\w\/]*\',([\w]{6,8}),/) {
    if ($F == 1) {
        print "\n$ARGV[0],$St,$1";
    }
} elsif ($_ =~ /PARM=\'(BMP)|(DLI),([\w]{6,8}),/) {         <----A
    if ($F == 2) {
        print "\n$ARGV[0],$St,$3";                          <----B
    }
}
}

$F simply tells us that we are in fact expecting that format PARM.
$ARGV[0] contains an identifying value to show up first in the resulting
CSV file.

I thought that since parens are around both BMP and DLI ("A"), that the
part I want - ([\w]{6,8}) - would be called $3 ("B"). But this causes an
"uninitialized value" error. If I print $1, however, it has the value BMP.


How to print the third parenthesized part inside a regex?

Thanks
ji

__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

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

Reply via email to