in reply to Series of REGEX with OR

From "perldoc perlvar":

$1... Contains the subpattern from the corresponding set of capturing parentheses from the last successful pattern match

Some of your regexen do have capture but not all of them.

If the last regex tested does NOT have (capturing parens), $1 will not have a value, resulting the warning you are getting.

If you expect the URL only after "Archive", you can capture it thus:

... && my ($url)= $line =~ m/\/Archives(.*)/img && ...

        This is not an optical illusion, it just looks like one.

Replies are listed 'Best First'.
Re^2: Series of REGEX with OR
by wrkrbeee (Scribe) on Apr 27, 2016 at 17:24 UTC
    Thanks NetWallah! So if I move the capturing regex to be the last regex, then $1 should capture my extract target? Thanks again1

      Assuming one of your other regexes haven't matched already, because otherwise it'll short circuit and not capture.