Gabriella said:
Could somebody give me the meaning of each line ?
while (<IN>) {
A while loop; this reads a line from file handle IN into
$_. It stops looping when there's nothing more to read
from IN.
Take the line you just read in $_ and assign it to
$line. my makes it a lexical variable (it only
exists inside the {} block.)
Remove the trailing newline from $line
next if ($line =~ /^ *$/m);
Skip the rest of this loop iteration if $line is only
spaces, or empty. The /m is only meaningful if
$line contains multiple lines, and is pointless here.
next if ($line =~ /^#.*$/m);
Skip the rest of this loop interation is $line begins
with a #. The '.*$' is pointless, as is the /m.
next if ($line !~ /^[0-9].*$/m);
Skip the rest of this loop if line does not start with
a digit. Once again, the '.*$' and the /m are pointless.
Would delete everything in $line from the first # to the
end of the line, if it weren't commented out. /m is
still pointless.
Deletes any trailing spaces in $line. /m is still pointless.
Deletes any leading spaces in $line. Utterly pointless
as a previous line terminated this iteration unless $line
started with a digit.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"