Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Help Me!

by Swalif (Scribe)
on Apr 10, 2011 at 02:34 UTC ( [id://898559]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Help Me!
in thread Help Me!

Is there a problem to provide another solution?
So how do you know that the later code is not easy to read and learn ?

Replies are listed 'Best First'.
Re^4: Help Me!
by ajbrewe (Novice) on Apr 10, 2011 at 03:21 UTC

    Swalif, your example made a lot of sense but I already did it the other way, I'm the only girl in my class and I think most of the guys are too shy to help me so thanks to everyone for the help. I played around with the code and was able to figure it out. I've programmed in Java, C++, and Visual Basics so PERL is a little different then what I'm used to. I'm sure I'll be asking for more help on later programs. :)

Re^4: Help Me!
by GrandFather (Saint) on Apr 10, 2011 at 04:39 UTC

    The OP already had a solution that did everything your code did and more (although your list context variable initialisation was good). However the introduction of a module for trivial I/O was a major distraction. If there was a good reason for using the module you didn't provide any explanation for it nor did you say how your sample improved on what the OP already showed.

    True laziness is hard work
      Using this standard module will improve readability at least for those who are from Java background like me and the OP. The later code didn't have special variables nor any Regex and had only one loop. I hope these are improvements.
      regards
        my ($id, $name, $major, $email) = split(',',$line);

        The later code didn't have special variables nor any Regex

        The first argument to split, although represented above as the string ',', is actually the regex /,/.

        And your code also has the added advantage of slurping the entire file into memory.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://898559]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-23 15:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found