3 questions from beginner.

Q1:

open(LOG, ">>/home/bin/counts ABC.txt")

Does "LOG" refer to a file name to be opened? How about ">>"?

Q2:

line 1: if (/^\*/ && / 1 S/)
line 2: {
line 3:  @array = split(':');
line 4:  $Idd{$rec[$#rec]}=1;
line 5:   $count++;
line 6: }

How do we interpret 3rd and 4th lines?

Q3:

What does this function "chomp()" do?

chomp($Time)

Pls advise and thanks.
qiang8Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

shlomoyCommented:
LOG refers to the file
/home/bin/counts/ABC.txt

>> should mean you open the file for writing and when you open it again it appends the extra data rather then overwriting it.

chomp() gets a string and checks to see if it ends with a line-feed (enter) - if it ends with that - that character is "chopped".
otherwise, nothing happens.

from the man page:
chomp removes any line ending that corresponds
             to the current value of $/ (also known as
             $INPUT_RECORD_SEPARATOR in the English module).  It
             returns the number of characters removed.  It's
             often used to remove the newline from the end of an
             input record when you're worried that the final
             record may be missing its newline.  When in
             paragraph mode ($/ = ""), it removes all trailing
             newlines from the string.  If VARIABLE is omitted,
             it chomps $_.  Example:

                 while (<>) {
                     chomp;  # avoid \n on last field
                     @array = split(/:/);
                     ...
                 }

             You can actually chomp anything that's an lvalue,
             including an assignment:

                 chomp($cwd = `pwd`);
                 chomp($answer = <STDIN>);

             If you chomp a list, each element is chomped, and
             the total number of characters removed is returned.

0
qiang8Author Commented:
Thanks. How about question 2.
0
shlomoyCommented:
line 3:

take the string at $_
cut is into several strings, cut by the ':' character.
substrings will be put in the array named @array
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

shlomoyCommented:
>line 4:  $Idd{$rec[$#rec]}=1;

assign the value 1 to the hashtable entry (of the hashtable $ldd).
the key of the entry is at the last entry of the array $rec.
0
shlomoyCommented:
do I win the 100 points? :-)
0
qiang8Author Commented:
Thank you very much. Pls lock the answer so that I can award u points and a good grade.
0
qiang8Author Commented:
Thank you very much. Pls lock the answer so that I can award u points and a good grade.
0
qiang8Author Commented:
Thank you.
0
shlomoyCommented:
Anytime.
0
intaniaCommented:
How about line 1 of Q2?
I'm also beginner.
0
ozoCommented:
(
/^     #match the beginning of the line
\*     #quote the *
/x     #see `perldoc perlre`
 &&    #short-circuit logical AND, returns the right value if the left value is true, if the left value is false, the right value is not evaluated, `see perldoc perlop`
/ 1 S/ #match a space, the digit 1, a space, the letter S
)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.