Your skill will accomplish
what the force of many cannot
difference in regexby ovedpo15 (Pilgrim)
|on May 29, 2018 at 12:56 UTC||Need Help??|
ovedpo15 has asked for the wisdom of the Perl Monks concerning the following question:
Consider the following string: "a,b,c,d,5"
The format of the string is like this: "substr,substr,substr,...,value"
I use regex to check the string:
It works fine but it doesn't look very good.
I cant understand why in my ($value) = ($row =~ /.*,(.*)/); I need the brackets on the scalar but in ($row =~ s/,[^,]*$//); I don't need.
In other words, why is there is a syntax difference between the following two lines:
Testing: my $row = "a,b,c,d,15";
Output of first line: 15
Output of second line: 1 (why not a,b,c,d?)
How to do it in the same way?