What is the best way to achieve sscanf
-like functionality in perl?
I am looking now looking at the sscanf
module,
Which is better,
Option-1: Going sscanf
way?
Option-2: Regex way? [I am a beginner when it comes to Regex]
What is the best way to achieve sscanf
-like functionality in perl?
I am looking now looking at the sscanf
module,
Which is better,
Option-1: Going sscanf
way?
Option-2: Regex way? [I am a beginner when it comes to Regex]
You can use the regular expression.
If you want to use the sscanf module, you need to download that module. So it will occupies the space.
Instead of this, you use the regular expression only.
According to me regular expression is the better way
There is more than one way to do itTM.
However, regular expressions are quite more versatile than sscanf. They are also not difficult to learn.
In Perl, an attempt to mimic the functionality of sscanf would most likely make heavy use of regular expressions.
Guess what? CPAN have a sscanf module for Perl!
Regex is better, but TIMTOWTDI.
The Perl documentation includes this tidbit:
I would say that learning regexes is well worth it; they are part of the core strength of Perl and are a useful tool elsewhere too.