What does "$line =~ /\-?(?:\d+\.?\d*|\.\d+)/g mean in perl?
Could someone please explain to me character by character?
- AlanLv 76 months ago
I don't understand the ? and they could change the meaning of other expression
(like tell you to ignore them )
d means digits (0-9)
+ means 1 or more of the item before it
* means 0 or more of the item before it.
. means any characters
| means or
/g (means globally) (check again and again )
if variable $line contains
now bit by bit
/- means escape sequence -
means contains a - (I think)
I don't understand all the ? and the
":" (it may be part of ? expression.
\d+ means one or more digits (0-9)
\. means any character
\d* means zero or more digits (0-9)
from this site
It evaluates this part
as seen in the image below, You put it in your self to try again.