in reply to Re^2: How can I test for the representation of an integer?
in thread How can I test for the representation of an integer?
One is a match and the other is a count - you can tell that from the different ways you have constructed the regex. By choosing a confusing value to test against makes this less obvious. Instead try with "2":
$ perl -MData::Dumper -e 'print Dumper("2" =~ /2/);' $VAR1 = 1; $ perl -MData::Dumper -e 'print Dumper("2" =~ /(2)/);' $VAR1 = '2';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How can I test for the representation of an integer?
by haukex (Archbishop) on Apr 25, 2016 at 11:43 UTC | |
|
Re^4: How can I test for the representation of an integer?
by sm@sh (Acolyte) on Apr 25, 2016 at 11:14 UTC | |
by hippo (Archbishop) on Apr 25, 2016 at 11:25 UTC |