Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to achieve sscanf-like functionality in Perl?

Tags:

c

string

regex

perl

What is the best way to achieve sscanf-like functionality in Perl?

I am looking at the sscanf module.

Which is better:

  1. Going sscanf way?
  2. Regex way? (I am a beginner when it comes to Regex.)
like image 657
Alphaneo Avatar asked Mar 11 '10 02:03

Alphaneo


1 Answers

The Perl documentation includes this tidbit:

  • scanf

    scanf() is C-specific, use <> and regular expressions instead, see perlre.

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.

like image 115
ephemient Avatar answered Nov 16 '22 01:11

ephemient