in reply to Re^2: explanation of passages of a Perl script
in thread explanation of passages of a Perl script
I have serious problems to understand the variables (like $sub) that have been used, in particular when we have the feature "substr".
substr() is a built-in function in perl. All of the built-in functions are documented and if your machine has the perl documentation installed you can simply run perldoc -f substr to read it. Alternatively, it is available online here.
also the variables -$#qual: why I have to write them like that?
$#qual is a special syntax, it returns the index of the last element in the array @qual. See the Arrays: A Tutorial/Reference for a discussion of this and many other aspects of using arrays in perl.
when I use warnings and diagnostics I have an error of unitialized value in operation that I can't really resolve
You can find the offending term and then surround it with a suitable "if" statement. Suppose $foo might sometimes be undefined, but you want to print it, you might then use:
if (defined $foo) { print $foo; }
or, equivalently
print $foo if defined $foo;
Perl is a very big language with lots to learn. I think you would benefit from reading some of the Tutorials here covering the areas that you know less well. Stick at it - you will soon be amazed at what you can achieve.
|
|---|