It is basically a combination of the map function, and regular expressions.
The map function (map EXPR,LIST) evaluate EXPR for each element of LIST and returns the list value composed of the result of the evalutaion on each element of LIST. In this case, @rpagestats is the list.
The first parameter for the map function is { s/^(.+?logd{6}.txt:)//, s/ (save) / *$1* /, $pagestats .= "$_" }.
Here are some hints for you to understand these regular expressions:
s/ = means that a substitution will be made. (Example: s/STRING A/STRING B/ will replace STRING A with STRING B)
^ = means that the string that is to be matched must appear at the beginning of the text
. = match any character
+ = match 1 or more times
? = match 0 or more times
d{n} = match exactly n digits
. = match a "." (dot)
Have a look at the following pages. they will help you a lot.
<a href="http://perldoc.perl.org/functions/map.html">Perl Map function</a>
<a href="http://www.troubleshooters.com/codecorn/littperl/perlreg.htm">Perl Regular Expressions</a>
Good luck.
-Carlosdl
Last Wiki Answer Submitted: October 1, 2008 6:23 pm by carlosdl63,535 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.