in reply to Regular expressions - match
For CSV data see Text::CSV.
Here's a simple example using regex:
Update/FYI: Your RE does not work because the .*'s are greedy.
Here's a simple example using regex:
You can modify the RE as you see fit and/or put the data in a hash.use warnings; use strict; my $string1 = "one=1,two=2,three=3,four=4,five=5"; my $string2 = "one=1,three=3,five=5"; for ($string1, $string2) { print "$_\n"; print "$1=$2\n" while /(\w+)=(\d+)/g; }
Update/FYI: Your RE does not work because the .*'s are greedy.
|
---|
In Section
Seekers of Perl Wisdom