What does $1 mean in Perl? Further, what does $2 mean? How many $number variables are there?
See Question&Answers more detail:osWhat does $1 mean in Perl? Further, what does $2 mean? How many $number variables are there?
See Question&Answers more detail:osThe $number
variables contain the parts of the string that matched the capture groups ( ... )
in the pattern for your last regex match if the match was successful.
For example, take the following string:
$text = "the quick brown fox jumps over the lazy dog.";
After the statement
$text =~ m/ (b.+?) /;
$1
equals the text "brown
".