Hi Perl Monks, have a series of regexs that work great until I impose a series of OR conditions. I receive an error stating "use of uninitialized value for $url_sub at line 45." Excluding the OR series eliminates the error, so I'm not sure how the ORs create an error. Grateful for any ideas. Thanks!
while (my $line = <$FH_IN>) { chomp $line; #removes line break or new line; my $url_sub = ""; print "processing file $counter,\n"; # Within each record, loop until a match occurs with "subsid" in the r +ecord,; # and the record contains a URL address, and the URL contain a derivat +ive; # of Exhibt 21, e.g., ex21, ex-21, exhibit21, or exhibt-21; + while ($line =~ m/subsidiar/igm && $line =~ m/\/Archives(.* +)">/igm && ($line =~ m/ex21/igm || $line =~ m/EX\-21/igm || $line =~ m/exhibit\-21/igm || $line =~ m/exhibit21/i +gm) ) { $url_sub = $1; #extract the match and assign to var +iable; #Join the match with the standard URL prefix; my $url = join("",$base_url,$url_sub); print $url; open my $FH_OUT, '>>',$write_dir or die "Can't open fi +le $write_dir >:$!>"; print $FH_OUT "$url\n"; ++$counter; } #End of while loop for extracting matching text; } #End of record;
In reply to Series of REGEX with OR by wrkrbeee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |