Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is $1 in Perl?

Tags:

regex

perl

What is the $1? Is that the match found for (\d+)?

$line =~ /^(\d+)\s/; 
next if(!defined($1) ) ;
$paperAnnot{$1} = $line;
like image 581
Tony Stark Avatar asked Dec 05 '25 21:12

Tony Stark


1 Answers

You are right, $1 means the first capturing group, in your example that is (\d+)

like image 105
knittl Avatar answered Dec 07 '25 11:12

knittl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!